gcc/testsuite/g++.dg/cpp0x/constexpr-typeid2.C
raw| 1 | // PR c++/103600 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | // { dg-additional-options "-fdelete-null-pointer-checks" } |
| 4 | |
| 5 | #include <typeinfo> |
| 6 | |
| 7 | struct S { int i; }; |
| 8 | namespace { |
| 9 | struct T { int i; }; |
| 10 | }; |
| 11 | constexpr bool a = &typeid (int) == &typeid (int); |
| 12 | constexpr bool b = &typeid (int) == &typeid (long); |
| 13 | constexpr bool c = &typeid (double) != &typeid (int); |
| 14 | constexpr bool d = &typeid (S) != &typeid (T); |
| 15 | static_assert (a && !b && c && d, ""); |