https://github.com/Serosh-commits updated https://github.com/llvm/llvm-project/pull/184210
>From 4b51b18b24cb3bfa48c08d9fa2cd7399300f6fb1 Mon Sep 17 00:00:00 2001 From: Serosh-commits <[email protected]> Date: Tue, 3 Mar 2026 00:14:40 +0530 Subject: [PATCH] fix explicit incomplete enum --- clang/docs/ReleaseNotes.rst | 1 + clang/lib/Sema/SemaOverload.cpp | 3 +++ clang/test/SemaCXX/gh183887.cpp | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 clang/test/SemaCXX/gh183887.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 86cee7d1b6f9b..14a1103cc05be 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -286,6 +286,7 @@ Bug Fixes to C++ Support - Fixed a bug where captured variables in non-mutable lambdas were incorrectly treated as mutable when used inside decltype in the return type. (#GH180460) - Fixed a crash when evaluating uninitialized GCC vector/ext_vector_type vectors in ``constexpr``. (#GH180044) +- Fixed a crash when `explicit(bool)` is used with an incomplete enumeration. (#GH183887) Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 81edf966de9e7..9347f36c4fd2b 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -6357,6 +6357,9 @@ static ExprResult BuildConvertedConstantExpression(Sema &S, Expr *From, if (checkPlaceholderForOverload(S, From)) return ExprError(); + if (From->containsErrors()) + return S.CreateRecoveryExpr(From->getBeginLoc(), From->getEndLoc(), {From}, T); + // C++1z [expr.const]p3: // A converted constant expression of type T is an expression, // implicitly converted to type T, where the converted diff --git a/clang/test/SemaCXX/gh183887.cpp b/clang/test/SemaCXX/gh183887.cpp new file mode 100644 index 0000000000000..ee6c8c667bf1e --- /dev/null +++ b/clang/test/SemaCXX/gh183887.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +namespace GH183887 { +enum E1 explicit(E1()); // expected-error {{initialization of incomplete type 'E1'}} +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
