https://github.com/osamakader updated 
https://github.com/llvm/llvm-project/pull/210085

>From ae6df644f97e3f2347ec992194385949324e55e0 Mon Sep 17 00:00:00 2001
From: Osama Abdelkader <[email protected]>
Date: Thu, 16 Jul 2026 17:38:30 +0200
Subject: [PATCH 1/2] [Clang] Avoid querying tag definitions for invalid
 DeclSpecs

Guard hasTagDefinition() against invalid type-specifier state so recovery from 
invalid auto/tag combinations does not assert.

Signed-off-by: Osama Abdelkader <[email protected]>
---
 clang/lib/Sema/DeclSpec.cpp       | 2 +-
 clang/test/SemaCXX/auto-cxx0x.cpp | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index 4d20657d5e517..9df12d0c4ce75 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -431,7 +431,7 @@ void DeclSpec::forEachQualifier(
 }
 
 bool DeclSpec::hasTagDefinition() const {
-  if (!TypeSpecOwned)
+  if (!TypeSpecOwned || !isDeclRep((TST)TypeSpecType))
     return false;
   return cast<TagDecl>(getRepAsDecl())->isCompleteDefinition();
 }
diff --git a/clang/test/SemaCXX/auto-cxx0x.cpp 
b/clang/test/SemaCXX/auto-cxx0x.cpp
index fa953f35723ef..ff2c98fce7523 100644
--- a/clang/test/SemaCXX/auto-cxx0x.cpp
+++ b/clang/test/SemaCXX/auto-cxx0x.cpp
@@ -14,6 +14,9 @@ void f() {
 struct PR209000 {
 } auto; // expected-error {{'auto' cannot be combined with a type specifier}}
 
+auto union { // expected-error {{cannot combine with previous 'auto' 
declaration specifier}}
+} foo<>; // expected-error {{no template named 'foo'}}
+
 typedef auto PR25449(); // expected-error {{'auto' not allowed in typedef}}
 
 thread_local auto x; // expected-error {{requires an initializer}}

>From da2d9c93b52e457fb88f303f07aabfd1dc468a4b Mon Sep 17 00:00:00 2001
From: Osama Abdelkader <[email protected]>
Date: Mon, 20 Jul 2026 15:51:48 +0200
Subject: [PATCH 2/2] [Clang] update ReleaseNotes with #GH210014 fix

Signed-off-by: Osama Abdelkader <[email protected]>
---
 clang/docs/ReleaseNotes.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 052838ef0af0d..2bb80455b85a6 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -155,6 +155,9 @@ latest release, please see the [Clang Web 
Site](https://clang.llvm.org) or the
 
 #### Miscellaneous Clang Crashes Fixed
 
+- Fixed a crash when parsing invalid C++ declarations that combine `auto` with
+  an anonymous tag definition. (#GH210014)
+
 ### OpenACC Specific Changes
 
 ### OpenCL Specific Changes

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to