Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C

raw
1 // PR c++/92062 - ODR-use ignored for static member of class template.
2 // { dg-do run { target c++11 } }
3 // { dg-additional-options "-fdelete-null-pointer-checks" }
4
5 template<int> struct A {
6 static const bool x;
7 static_assert(&x, ""); // odr-uses A<...>::x
8 };
9
10 int g;
11
12 template<int I>
13 const bool A<I>::x = (g = 42, false);
14
15 void f(A<0>) {} // A<0> must be complete, so is instantiated
16 int main()
17 {
18 if (g != 42)
19 __builtin_abort ();
20 }