comparison gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
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 }