[clang] [clang]fix ppcaching assertion gh186582 (PR #187370)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 19 12:59:49 PDT 2026
https://github.com/Serosh-commits updated https://github.com/llvm/llvm-project/pull/187370
>From e9b8aeea0bf90303d30387d762d69ff29e40d2fa Mon Sep 17 00:00:00 2001
From: Serosh-commits <janmejayapanda400 at gmail.com>
Date: Thu, 19 Mar 2026 00:57:24 +0530
Subject: [PATCH] test update
---
clang/docs/ReleaseNotes.rst | 7 ++++---
clang/lib/Parse/ParseExprCXX.cpp | 4 ++--
clang/test/Parser/gh186582.cpp | 6 ++++++
3 files changed, 12 insertions(+), 5 deletions(-)
create mode 100644 clang/test/Parser/gh186582.cpp
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 613d87668be18..91fbeb82aa04e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -227,6 +227,7 @@ Bug Fixes in This Version
- Fixed atomic boolean compound assignment; the conversion back to atomic bool would be miscompiled. (#GH33210)
- Fixed a failed assertion in the preprocessor when ``__has_embed`` parameters are missing parentheses. (#GH175088)
+- Fixed an assertion failure in the preprocessor when encountering ``::template operator`` during tentative parsing. (#GH186582)
- Fix lifetime extension of temporaries in for-range-initializers in templates. (#GH165182)
- Fixed a preprocessor crash in ``__has_cpp_attribute`` on incomplete scoped attributes. (#GH178098)
@@ -343,7 +344,7 @@ AST Matchers
clang-format
------------
-- Add ``ObjCSpaceAfterMethodDeclarationPrefix`` option to control space between the
+- Add ``ObjCSpaceAfterMethodDeclarationPrefix`` option to control space between the
'-'/'+' and the return type in Objective-C method declarations
libclang
@@ -378,8 +379,8 @@ Python Binding Changes
Affected methods: ``isKindOptional``, ``isKindTypedText``, ``isKindPlaceHolder``,
``isKindInformative`` and ``isKindResultType``.
- Add a deprecation warning to ``CodeCompletionResults.results``.
- This property will become an implementation detail with changed behavior in a
- future release and should not be used directly.. Existing uses of
+ This property will become an implementation detail with changed behavior in a
+ future release and should not be used directly.. Existing uses of
``CodeCompletionResults.results`` should be changed to directly use
``CodeCompletionResults``: it nows supports ``__len__`` and ``__getitem__``,
so it can be used the same as ``CodeCompletionResults.results``.
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..c5094724ba6e5
--- /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 at 6 {{expected a type}}
+// expected-error {{expected unqualified-id}}
More information about the cfe-commits
mailing list