Ticket #7219: test_gcc_bug.cpp

File test_gcc_bug.cpp, 1.7 KB (added by Tony.Astolfi@…, 10 years ago)

test case source file

Line 
1//
2// Copyright (C) 2010-2012 The Mathworks, Inc.
3//
4#include <test_manager.h>
5
6#include <boost/optional.hpp>
7
8struct my_type
9{
10#if 1
11 typedef boost::optional<int> value_type;
12#else
13 typedef boost::optional<int __attribute((__may_alias__))> value_type;
14#endif
15
16 value_type value_;
17
18 void set (int value)
19 {
20 value_ = value;
21 }
22
23 value_type get ()
24 {
25 return value_;
26 }
27
28}; // class event
29
30void testCase ()
31{
32 my_type a;
33 a.set(4);
34 bool const b = 4 == ( *a.get() );
35 if( !b ) abort();
36}
37
38REG_UNIT_TEST( Case )
39
40/*
41/gcc-4.4.6/bin/g++ -c src/thread/unittest/test_gcc_bug.cpp -o ../../../derived/glnxa64/obj/deployment_server/foundation/util/src/thread/unittest/test_gcc_bug.o -MD -MF ../../../derived/glnxa64/obj/deployment_server/foundation/util/src/thread/unittest/test_gcc_bug.d -MP -MT ../../../derived/glnxa64/obj/deployment_server/foundation/util/src/thread/unittest/test_gcc_bug.o -I../../../src/include -I../../../derived/glnxa64/src/include -I../include -I../../include -I//mathworks/hub/3rdparty/R2013a/356881/glnxa64/boost/include -I//mathworks/hub/3rdparty/R2013a/356141/glnxa64/cpp11compat/include -I//mathworks/hub/3rdparty/R2013a/356141/glnxa64/cpp11compat/include -I//mathworks/hub/3rdparty/R2013a/350182/glnxa64/protobuf/include -I//mathworks/hub/3rdparty/R2013a/350182/glnxa64/tbb/include -DBOOST_FILESYSTEM_VERSION=2 -DBOOST_ASIO_DISABLE_EVENTFD -DBOOST_ASIO_DISABLE_EPOLL -DTBB_AVAILABLE -O2 -pipe -pthread -fPIC -std=c++98 -fvisibility=hidden -g -D_POSIX_C_SOURCE=199506L -fno-omit-frame-pointer -DNDEBUG -W -Wcast-align -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wno-unused -Woverloaded-virtual -Wnon-virtual-dtor -Wno-ignored-qualifiers
42 */