summaryrefslogtreecommitdiff
path: root/test/SemaCXX/uninitialized.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/uninitialized.cpp')
-rw-r--r--test/SemaCXX/uninitialized.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp
index 5769a0c028c8..7a23f3cef2c4 100644
--- a/test/SemaCXX/uninitialized.cpp
+++ b/test/SemaCXX/uninitialized.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wall -Wuninitialized -Wno-unused-value -std=c++11 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wuninitialized -Wno-unused-value -std=c++1z -verify %s
// definitions for std::move
namespace std {
@@ -1437,3 +1437,13 @@ void array_capture(bool b) {
[fname]{};
}
}
+
+void if_switch_init_stmt(int k) {
+ if (int n = 0; (n == k || k > 5)) {}
+
+ if (int n; (n == k || k > 5)) {} // expected-warning {{uninitialized}} expected-note {{initialize}}
+
+ switch (int n = 0; (n == k || k > 5)) {} // expected-warning {{boolean}}
+
+ switch (int n; (n == k || k > 5)) {} // expected-warning {{uninitialized}} expected-note {{initialize}} expected-warning {{boolean}}
+}