28 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -include %s -verify %s2// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t3// RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH4// RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t5// RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH6 7#ifndef HEADER8#define HEADER9 10struct S {11 unsigned int n : 5 = 49; // expected-warning {{changes value}}12};13 14int a;15template<bool B> struct T {16 int m : B ? 8 : a = 42;17};18 19#else20 21// expected-error@-5 {{constant expression}} expected-note@-5 {{cannot modify}}22 23static_assert(S().n == 17);24static_assert(T<true>().m == 0);25int q = T<false>().m; // expected-note {{instantiation of}}26 27#endif28