diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -553,6 +553,10 @@ (`#48512 `_). - Fixed a failing assertion when parsing incomplete destructor. (`#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 `_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp --- a/clang/lib/Parse/ParseTentative.cpp +++ b/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; } diff --git a/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp b/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp --- a/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp +++ b/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp @@ -247,3 +247,11 @@ }; } + +namespace GH57495 { +template struct vector{}; + +void f() { + GH57495::vector.d; // expected-error {{cannot use dot operator on a type}} +} +}