[PATCH] D134334: [Clang] Fix crash in isCXXDeclarationSpecifier when attempting to annotate template name
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 29 15:43:44 PDT 2023
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd1fcce97a6af: [Clang] Fix crash in isCXXDeclarationSpecifier when attempting to annotate… (authored by shafik).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D134334?vs=527937&id=536040#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134334/new/
https://reviews.llvm.org/D134334
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Parse/ParseTentative.cpp
clang/test/Parser/cxx1z-class-template-argument-deduction.cpp
Index: clang/test/Parser/cxx1z-class-template-argument-deduction.cpp
===================================================================
--- clang/test/Parser/cxx1z-class-template-argument-deduction.cpp
+++ clang/test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -247,3 +247,11 @@
};
}
+
+namespace GH57495 {
+template <typename T> struct vector{};
+
+void f() {
+ GH57495::vector.d; // expected-error {{cannot use dot operator on a type}}
+}
+}
Index: clang/lib/Parse/ParseTentative.cpp
===================================================================
--- clang/lib/Parse/ParseTentative.cpp
+++ clang/lib/Parse/ParseTentative.cpp
@@ -1656,7 +1656,10 @@
if (getLangOpts().CPlusPlus17) {
if (TryAnnotateTypeOrScopeToken())
return TPResult::Error;
- if (Tok.isNot(tok::identifier))
+ // If we annotated then the current token should not still be ::
+ // FIXME we may want to also check for tok::annot_typename but
+ // currently don't have a test case.
+ if (Tok.isNot(tok::annot_cxxscope))
break;
}
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -553,6 +553,10 @@
(`#48512 <https://github.com/llvm/llvm-project/issues/48512>`_).
- Fixed a failing assertion when parsing incomplete destructor.
(`#63503 <https://github.com/llvm/llvm-project/issues/63503>`_)
+- Fix C++17 mode assert when parsing malformed code and the compiler is
+ attempting to see if it could be type template for class template argument
+ deduction. This fixes
+ (`Issue 57495 <https://github.com/llvm/llvm-project/issues/57495>`_)
Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134334.536040.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230629/d146886a/attachment-0001.bin>
More information about the cfe-commits
mailing list