1 | // RUN: %clang_cc1 -std=c++2a -include %s -verify %s |
2 | // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t |
3 | // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH |
4 | |
5 | #ifndef HEADER |
6 | #define HEADER |
7 | |
8 | struct S { |
9 | unsigned int n : 5 = 49; // expected-warning {{changes value}} |
10 | }; |
11 | |
12 | int a; |
13 | template<bool B> struct T { |
14 | int m : B ? 8 : a = 42; |
15 | }; |
16 | |
17 | #else |
18 | |
19 | // expected-error@-5 {{constant expression}} expected-note@-5 {{cannot modify}} |
20 | |
21 | static_assert(S().n == 17); |
22 | static_assert(T<true>().m == 0); |
23 | int q = T<false>().m; // expected-note {{instantiation of}} |
24 | |
25 | #endif |
26 | |