diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1z/inline-var5.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/inline-var5.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var5.C b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C new file mode 100644 index 00000000000..6d1edd288ae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var5.C @@ -0,0 +1,27 @@ +// PR c++/89405 +// { dg-do compile { target c++17 } } +// { dg-options "-fno-weak" } + +template <int N> +struct S +{ + static constexpr int a = N; // { dg-warning "semantics of inline variable" } +}; // { dg-message "you can work around this" "" { target *-*-* } .-1 } + +const int *x = &S<0>::a; +// PR c++/87921 +// { dg-do compile { target c++17 } } + +template <class H> +struct X +{ + static inline long x[] = { 1L }; + long foo () { return x[0]; } +}; + +void +bar () +{ + class L {}; + X<L> v {}; +} |