diff options
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C')
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C new file mode 100644 index 000000000..30bbc18a1 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret1.C @@ -0,0 +1,39 @@ +// PR c++/56728 +// { dg-require-effective-target c++11 } + +// { dg-prune-output "error" } + +class B { +public: + static B instance; + class Inner + { + public: + class Wuzi + { + unsigned int m; + } m_Class[3]; + unsigned m_Int[4]; + }; + + constexpr static Inner & getInner() + { + /* I am surprised this is considered a constexpr */ + return *((Inner *)4); + } +}; + +B B::instance; + +class A +{ +public: + constexpr A(B &bridge, B::Inner &bridge2, unsigned char index) + : m_Bridge(bridge), m_Wuz(bridge2.m_Class[index]) + {} + + B &m_Bridge; + B::Inner::Wuzi &m_Wuz; +}; +A works{B::instance, B::getInner(), 3}; +A crashnkill[1]{{B::instance, B::getInner(), 3}}; |