[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
Fri Jun 2 12:41:56 PDT 2023
shafik updated this revision to Diff 527937.
shafik added a comment.
- Update check to use tok::annot_cxxscope
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
@@ -1651,7 +1651,8 @@
if (getLangOpts().CPlusPlus17) {
if (TryAnnotateTypeOrScopeToken())
return TPResult::Error;
- if (Tok.isNot(tok::identifier))
+ // If we annotated then the current token should not still be ::
+ if (Tok.isNot(tok::annot_cxxscope))
break;
}
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -463,6 +463,10 @@
- Fix crash when passing a braced initializer list to a parentehsized aggregate
initialization expression.
(`#63008 <https://github.com/llvm/llvm-project/issues/63008>`_).
+- 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.527937.patch
Type: text/x-patch
Size: 1708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230602/1dffb611/attachment.bin>
More information about the cfe-commits
mailing list