https://github.com/nataliakokoromyti updated https://github.com/llvm/llvm-project/pull/177918
>From 8be4f10f0d4d5f0980aa6450321c995f2503fe19 Mon Sep 17 00:00:00 2001 From: nataliakokoromyti <[email protected]> Date: Mon, 26 Jan 2026 01:49:13 -0800 Subject: [PATCH] fix assertion failure with malformed destructor in literal type check --- clang/docs/ReleaseNotes.rst | 1 + clang/lib/Sema/SemaType.cpp | 1 - clang/test/SemaCXX/literal-type.cpp | 9 +++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index a5340a31d4fe9..bcecd448c3321 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -185,6 +185,7 @@ Bug Fixes to Attribute Support Bug Fixes to C++ Support ^^^^^^^^^^^^^^^^^^^^^^^^ - Fixed a crash when instantiating ``requires`` expressions involving substitution failures in C++ concepts. (#GH176402) +- Fixed an assertion failure when checking literal types with malformed destructor declarations. (#GH177894) Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 91d36f0502d85..d9110ab79ee6e 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -9679,7 +9679,6 @@ bool Sema::RequireLiteralType(SourceLocation Loc, QualType T, // destructors. If this class's destructor is non-trivial / non-constexpr, // it must be user-declared. CXXDestructorDecl *Dtor = RD->getDestructor(); - assert(Dtor && "class has literal fields and bases but no dtor?"); if (!Dtor) return true; diff --git a/clang/test/SemaCXX/literal-type.cpp b/clang/test/SemaCXX/literal-type.cpp index 44b6ba62262fd..6e0f311fd403d 100644 --- a/clang/test/SemaCXX/literal-type.cpp +++ b/clang/test/SemaCXX/literal-type.cpp @@ -176,3 +176,12 @@ static_assert(__is_literal(UnionWithNonLiteralMemberConstexprDtor2), "fail"); #endif } #endif + + +namespace GH177894 { +struct S { + ~S() = (0); // expected-error {{initializer on function does not look like a pure-specifier}} +}; + +void bar() { S s; } +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
