https://github.com/el-ev updated https://github.com/llvm/llvm-project/pull/144286
>From 6e10acb31f5975aad222bf211bcd61976a1c5108 Mon Sep 17 00:00:00 2001 From: Iris Shi <0...@owo.li> Date: Mon, 16 Jun 2025 09:37:17 +0800 Subject: [PATCH 1/2] [clang][Parser] Fix crash on malformed using declaration in constexpr function --- clang/docs/ReleaseNotes.rst | 1 + clang/lib/Parse/ParseDeclCXX.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 33ee8a53b5f37..59d9612268d30 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -704,6 +704,7 @@ Bug Fixes in This Version - Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168) - Fixed incorrect token location when emitting diagnostics for tokens expanded from macros. (#GH143216) - Fixed an infinite recursion when checking constexpr destructors. (#GH141789) +- Fixed a crash when a malformed using declaration appears in a ``constexpr`` function. (#GH144264) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index f31c9265a0074..a5c76501c7c18 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -760,6 +760,10 @@ Parser::DeclGroupPtrTy Parser::ParseUsingDeclaration( Decl *AD = ParseAliasDeclarationAfterDeclarator( TemplateInfo, UsingLoc, D, DeclEnd, AS, Attrs, &DeclFromDeclSpec); + + if (!AD) + return nullptr; + return Actions.ConvertDeclToDeclGroup(AD, DeclFromDeclSpec); } >From 0dd1fe12a85fe5255e62b4166a5e64756e042a60 Mon Sep 17 00:00:00 2001 From: Iris Shi <0...@owo.li> Date: Mon, 16 Jun 2025 22:42:54 +0800 Subject: [PATCH 2/2] test --- .../Parser/cxx-invalid-using-decl-in-constexpr-crash.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 clang/test/Parser/cxx-invalid-using-decl-in-constexpr-crash.cpp diff --git a/clang/test/Parser/cxx-invalid-using-decl-in-constexpr-crash.cpp b/clang/test/Parser/cxx-invalid-using-decl-in-constexpr-crash.cpp new file mode 100644 index 0000000000000..94fa8c8c820a5 --- /dev/null +++ b/clang/test/Parser/cxx-invalid-using-decl-in-constexpr-crash.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// issue144264 +constexpr void test() +{ + using TT = struct T[; + // expected-error@-1 {{expected expression}} +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits