diff options
Diffstat (limited to 'clang/test/SemaCXX/constant-expression-cxx2a.cpp')
-rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx2a.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx2a.cpp b/clang/test/SemaCXX/constant-expression-cxx2a.cpp index ec4263e3ee4..a1ab6e8e126 100644 --- a/clang/test/SemaCXX/constant-expression-cxx2a.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx2a.cpp @@ -620,4 +620,17 @@ namespace Uninit { constexpr int s1 = switch_var(1); constexpr int s2 = switch_var(2); static_assert(s1 == 1 && s2 == 2); + + constexpr bool switch_into_init_stmt() { + switch (1) { + if (int n; false) { + for (int m; false;) { + case 1: + n = m = 1; + return n == 1 && m == 1; + } + } + } + } + static_assert(switch_into_init_stmt()); } |