annotate clang/test/PCH/cxx2a-bitfield-init.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -std=c++2a -include %s -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
4 // RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
5 // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH
150
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 #ifndef HEADER
anatofuz
parents:
diff changeset
8 #define HEADER
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 struct S {
anatofuz
parents:
diff changeset
11 unsigned int n : 5 = 49; // expected-warning {{changes value}}
anatofuz
parents:
diff changeset
12 };
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 int a;
anatofuz
parents:
diff changeset
15 template<bool B> struct T {
anatofuz
parents:
diff changeset
16 int m : B ? 8 : a = 42;
anatofuz
parents:
diff changeset
17 };
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 #else
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 // expected-error@-5 {{constant expression}} expected-note@-5 {{cannot modify}}
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 static_assert(S().n == 17);
anatofuz
parents:
diff changeset
24 static_assert(T<true>().m == 0);
anatofuz
parents:
diff changeset
25 int q = T<false>().m; // expected-note {{instantiation of}}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 #endif