diff --git a/interpreter/llvm-project/clang/docs/ReleaseNotes.rst b/interpreter/llvm-project/clang/docs/ReleaseNotes.rst index 03ac96e974853..8d2e0c6764d5c 100644 --- a/interpreter/llvm-project/clang/docs/ReleaseNotes.rst +++ b/interpreter/llvm-project/clang/docs/ReleaseNotes.rst @@ -223,6 +223,8 @@ sections with improvements to Clang's support for those languages. C++ Language Changes -------------------- +- Implemented `CWG2518 `_ which allows ``static_assert(false)`` + to not be ill-formed when its condition is evaluated in the context of a template definition. C++20 Feature Support ^^^^^^^^^^^^^^^^^^^^^ diff --git a/interpreter/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp b/interpreter/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp index a33ef91fa109f..1838f5a62be70 100644 --- a/interpreter/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp +++ b/interpreter/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp @@ -16802,7 +16802,14 @@ Decl *Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, FoldKind).isInvalid()) Failed = true; - if (!Failed && !Cond) { + // CWG2518 + // [dcl.pre]/p10 If [...] the expression is evaluated in the context of a + // template definition, the declaration has no effect. + bool InTemplateDefinition = + getLangOpts().CPlusPlus && CurContext->isDependentContext(); + + if (!Failed && !Cond && !InTemplateDefinition) { + SmallString<256> MsgBuffer; llvm::raw_svector_ostream Msg(MsgBuffer); if (AssertMessage) { @@ -16833,7 +16840,8 @@ Decl *Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, DiagnoseStaticAssertDetails(InnerCond); } else { Diag(StaticAssertLoc, diag::err_static_assert_failed) - << !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); + << !AssertMessage << Msg.str() << AssertExpr->getSourceRange(); + PrintContextStack(); } Failed = true; } diff --git a/interpreter/llvm-project/clang/www/cxx_dr_status.html b/interpreter/llvm-project/clang/www/cxx_dr_status.html index 0c621a7894340..acd77bd99b5a9 100755 --- a/interpreter/llvm-project/clang/www/cxx_dr_status.html +++ b/interpreter/llvm-project/clang/www/cxx_dr_status.html @@ -14915,7 +14915,7 @@

C++ defect report implementation status

2518 review Conformance requirements and #error/#warning - Not resolved + Clang 17 2519 diff --git a/interpreter/llvm-project/llvm-project.tag b/interpreter/llvm-project/llvm-project.tag index aa4b18c999ba7..acd21506d992c 100644 --- a/interpreter/llvm-project/llvm-project.tag +++ b/interpreter/llvm-project/llvm-project.tag @@ -1 +1 @@ -ROOT-llvm16-20240402-01 +ROOT-llvm16-20240604-01