https://github.com/Serosh-commits updated 
https://github.com/llvm/llvm-project/pull/187370

>From fc94d3d2928711d1ed47de8b6390b7eaa0ad1d36 Mon Sep 17 00:00:00 2001
From: Serosh-commits <[email protected]>
Date: Thu, 19 Mar 2026 00:57:24 +0530
Subject: [PATCH 1/3] test update

---
 clang/docs/ReleaseNotes.rst      | 2 ++
 clang/lib/Parse/ParseExprCXX.cpp | 4 ++--
 clang/test/Parser/gh186582.cpp   | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/Parser/gh186582.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 613d87668be18..a493fc8667d93 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -327,6 +327,8 @@ SystemZ Support
 - Add support for `#pragma export` for z/OS.  This is a pragma used to export 
functions and variables
   with external linkage from shared libraries.  It provides compatibility with 
the IBM XL C/C++
   compiler.
+- Fixed an assertion failure in the preprocessor when encountering 
``::template operator`` during tentative parsing. (#GH186582)
+
 
 DWARF Support in Clang
 ----------------------
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 842b52375eb14..b50b5c383b961 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -286,7 +286,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
         // we already annotated the template-id.
         if (ParseUnqualifiedIdOperator(SS, EnteringContext, ObjectType,
                                        TemplateName)) {
-          TPA.Commit();
+          TPA.Revert();
           break;
         }
 
@@ -295,7 +295,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(
           Diag(TemplateName.getSourceRange().getBegin(),
                diag::err_id_after_template_in_nested_name_spec)
             << TemplateName.getSourceRange();
-          TPA.Commit();
+          TPA.Revert();
           break;
         }
       } else {
diff --git a/clang/test/Parser/gh186582.cpp b/clang/test/Parser/gh186582.cpp
new file mode 100644
index 0000000000000..2c5d7cc0e1c6b
--- /dev/null
+++ b/clang/test/Parser/gh186582.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s
+
+a(   ::template operator // expected-error {{a type specifier is required for 
all declarations}} \
+                         // expected-error {{expected ';' after top level 
declarator}}
+// expected-error@* {{expected a type}}
+// expected-error@* {{expected unqualified-id}}

>From 2cf7c32325d0dbe7ff385e363df87dd79344badf Mon Sep 17 00:00:00 2001
From: Serosh-commits <[email protected]>
Date: Fri, 20 Mar 2026 03:33:32 +0530
Subject: [PATCH 2/3] ci fix

---
 clang/test/Parser/gh186582.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/clang/test/Parser/gh186582.cpp b/clang/test/Parser/gh186582.cpp
index 2c5d7cc0e1c6b..fa9c8e8e0f0db 100644
--- a/clang/test/Parser/gh186582.cpp
+++ b/clang/test/Parser/gh186582.cpp
@@ -1,6 +1,2 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s
-
-a(   ::template operator // expected-error {{a type specifier is required for 
all declarations}} \
-                         // expected-error {{expected ';' after top level 
declarator}}
-// expected-error@* {{expected a type}}
-// expected-error@* {{expected unqualified-id}}
+a(   ::template operator // expected-error {{expected a type}} expected-error 
{{a type specifier is required for all declarations}} expected-error {{expected 
unqualified-id}} expected-error {{expected ';' after top level declarator}}
\ No newline at end of file

>From 111a1035dc2d62cfdb19de04428b245e21cf8062 Mon Sep 17 00:00:00 2001
From: Serosh <[email protected]>
Date: Fri, 20 Mar 2026 17:33:53 +0530
Subject: [PATCH 3/3] Update clang/test/Parser/gh186582.cpp

Co-authored-by: Aaron Ballman <[email protected]>
---
 clang/test/Parser/gh186582.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/test/Parser/gh186582.cpp b/clang/test/Parser/gh186582.cpp
index fa9c8e8e0f0db..a1d8417afeec5 100644
--- a/clang/test/Parser/gh186582.cpp
+++ b/clang/test/Parser/gh186582.cpp
@@ -1,2 +1,4 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++23 -verify %s
-a(   ::template operator // expected-error {{expected a type}} expected-error 
{{a type specifier is required for all declarations}} expected-error {{expected 
unqualified-id}} expected-error {{expected ';' after top level declarator}}
\ No newline at end of file
+a(   ::template operator // expected-error 2 {{expected a type}} \
+                            expected-error {{a type specifier is required for 
all declarations}} \
+                            expected-error {{expected ';' after top level 
declarator}}
\ No newline at end of file

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

Reply via email to