llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> This otherwise happens in ParseCaseExpression. If we don't call this, we don't perform the usual arithmetic conversions, etc. --- Full diff: https://github.com/llvm/llvm-project/pull/166326.diff 2 Files Affected: - (modified) clang/lib/Parse/ParseStmt.cpp (+1-2) - (modified) clang/test/SemaCXX/constant-expression-cxx11.cpp (+6) ``````````diff diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 92038985f9163..47da1a5b7cdb0 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -813,8 +813,7 @@ StmtResult Parser::ParseCaseStatement(ParsedStmtContext StmtCtx, return StmtError(); } } else { - LHS = Expr; - MissingCase = false; + LHS = Actions.ActOnCaseExpr(CaseLoc, Expr); } // GNU case range extension. diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index 91c4ff1cb520d..7e28ac560ed23 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -2661,3 +2661,9 @@ namespace GH154567 { constexpr S s{}; static_assert(s.val.i == 0, ""); } + +constexpr bool missingCase() { + switch (1) { + 1u: return false; // expected-error {{expected 'case' keyword before expression}} + } +} `````````` </details> https://github.com/llvm/llvm-project/pull/166326 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
