summaryrefslogtreecommitdiff
path: root/test/Parser/cxx1z-decomposition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser/cxx1z-decomposition.cpp')
-rw-r--r--test/Parser/cxx1z-decomposition.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/Parser/cxx1z-decomposition.cpp b/test/Parser/cxx1z-decomposition.cpp
index 9cbe70e3c69b..cf4ba77723ad 100644
--- a/test/Parser/cxx1z-decomposition.cpp
+++ b/test/Parser/cxx1z-decomposition.cpp
@@ -32,13 +32,14 @@ namespace OtherDecl {
void f(auto [a, b, c]); // expected-error {{'auto' not allowed in function prototype}} expected-error {{'a'}}
void g() {
- // A condition is not a simple-declaration.
- for (; auto [a, b, c] = S(); ) {} // expected-error {{not permitted in this context}}
- if (auto [a, b, c] = S()) {} // expected-error {{not permitted in this context}}
- if (int n; auto [a, b, c] = S()) {} // expected-error {{not permitted in this context}}
- switch (auto [a, b, c] = S()) {} // expected-error {{not permitted in this context}}
- switch (int n; auto [a, b, c] = S()) {} // expected-error {{not permitted in this context}}
- while (auto [a, b, c] = S()) {} // expected-error {{not permitted in this context}}
+ // A condition is allowed as a Clang extension.
+ // See commentary in test/Parser/decomposed-condition.cpp
+ for (; auto [a, b, c] = S(); ) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}}
+ if (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}}
+ if (int n; auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}}
+ switch (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{statement requires expression of integer type ('S' invalid)}}
+ switch (int n; auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{statement requires expression of integer type ('S' invalid)}}
+ while (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}}
// An exception-declaration is not a simple-declaration.
try {}