summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx17-compat.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-22 19:52:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-22 19:52:55 +0000
commit13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f (patch)
tree7de36123533f812e0fcea10b020e7eb2a1c8556b /clang/test/SemaCXX/cxx17-compat.cpp
parent6dbf4a86a7c8d2a63aebb96c3e7d1ac477a40d9e (diff)
downloadbcm5719-llvm-13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f.tar.gz
bcm5719-llvm-13bf9892dc2a37a4c4a0fcce8cb79ed8798a236f.zip
Part of P1091R3: permit structured bindings to be declared 'static' and
'thread_local' in C++20. llvm-svn: 361424
Diffstat (limited to 'clang/test/SemaCXX/cxx17-compat.cpp')
-rw-r--r--clang/test/SemaCXX/cxx17-compat.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx17-compat.cpp b/clang/test/SemaCXX/cxx17-compat.cpp
index 5fcec2ab9cc..3d5420fa063 100644
--- a/clang/test/SemaCXX/cxx17-compat.cpp
+++ b/clang/test/SemaCXX/cxx17-compat.cpp
@@ -72,3 +72,19 @@ struct ConstexprVirtual {
// expected-warning@-4 {{virtual constexpr functions are incompatible with C++ standards before C++2a}}
#endif
};
+
+struct C { int x, y, z; };
+static auto [cx, cy, cz] = C();
+#if __cplusplus <= 201703L
+ // expected-warning@-2 {{decomposition declaration declared 'static' is a C++2a extension}}
+#else
+ // expected-warning@-4 {{decomposition declaration declared 'static' is incompatible with C++ standards before C++2a}}
+#endif
+void f() {
+ static thread_local auto [cx, cy, cz] = C();
+#if __cplusplus <= 201703L
+ // expected-warning@-2 {{decomposition declaration declared with 'static thread_local' specifiers is a C++2a extension}}
+#else
+ // expected-warning@-4 {{decomposition declaration declared with 'static thread_local' specifiers is incompatible with C++ standards before C++2a}}
+#endif
+}
OpenPOWER on IntegriCloud