diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index f314c9c72fa28..1d74c492845a6 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -363,6 +363,10 @@ Bug Fixes to C++ Support in the enclosing expression of a lambda expression with a noexcept specifier. (`#67492 `_) +- Fix crash when fold expression was used in the initialization of default + argument. Fixes: + (`#67395 `_) + Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ - Fixed an import failure of recursive friend class template. diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 0091e0ecf6f39..302e944d5d74f 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -86,7 +86,8 @@ class CheckDefaultArgumentVisitor bool CheckDefaultArgumentVisitor::VisitExpr(const Expr *Node) { bool IsInvalid = false; for (const Stmt *SubStmt : Node->children()) - IsInvalid |= Visit(SubStmt); + if (SubStmt) + IsInvalid |= Visit(SubStmt); return IsInvalid; } diff --git a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp index 518eaf0e05239..47a252eb335f6 100644 --- a/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp +++ b/clang/test/SemaTemplate/cxx1z-fold-expressions.cpp @@ -124,3 +124,11 @@ namespace PR30738 { int test_h3 = h(1, 2, 3); N::S test_h4 = h(N::S(), N::S(), N::S()); // expected-note {{instantiation of}} } + +namespace GH67395 { +template +bool f(); + +template +void g(bool = (f() || ...)); +}