summaryrefslogtreecommitdiff
path: root/test/PCH/cxx2a-bitfield-init.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:37 +0000
commit461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch)
tree6942083d7d56bba40ec790a453ca58ad3baf6832 /test/PCH/cxx2a-bitfield-init.cpp
parent75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff)
Diffstat (limited to 'test/PCH/cxx2a-bitfield-init.cpp')
-rw-r--r--test/PCH/cxx2a-bitfield-init.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/PCH/cxx2a-bitfield-init.cpp b/test/PCH/cxx2a-bitfield-init.cpp
new file mode 100644
index 0000000000000..344f3cb9129d1
--- /dev/null
+++ b/test/PCH/cxx2a-bitfield-init.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -std=c++2a -include %s -verify %s
+// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t
+// RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s -DPCH
+
+#ifndef HEADER
+#define HEADER
+
+struct S {
+ unsigned int n : 5 = 49; // expected-warning {{changes value}}
+};
+
+int a;
+template<bool B> struct T {
+ int m : B ? 8 : a = 42;
+};
+
+#else
+
+// expected-error@-5 {{constant expression}} expected-note@-5 {{cannot modify}}
+
+static_assert(S().n == 17);
+static_assert(T<true>().m == 0);
+int q = T<false>().m; // expected-note {{instantiation of}}
+
+#endif