================ @@ -1779,6 +1779,42 @@ void Parser::checkPotentialAngleBracket(ExprResult &PotentialTemplateName) { Priority); } +bool Parser::isMissingTemplateKeywordBeforeScope(bool AnnotateInvalid) { + assert(Tok.is(tok::coloncolon)); + Sema::DisableTypoCorrectionRAII DTC(Actions); + ColonProtectionRAIIObject ColonProtection(*this); + + SourceLocation StartLoc = Tok.getLocation(); + if (TryAnnotateTypeOrScopeToken()) + return true; + if (Tok.isSimpleTypeSpecifier(getLangOpts())) + return false; + CXXScopeSpec SS; + ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/nullptr, + /*ObjectHasErrors=*/false, + /*EnteringContext=*/false); + ExprResult Result = tryParseCXXIdExpression(SS, /*isAddressOfOperand=*/false); ---------------- zygoloid wrote:
Thanks for helping me understand :-) I misunderstood your previous comment (any tentative parsing done here will happen anyways when parsing the second operand of the > operator) as suggesting we'd sometimes parse and type-check the same thing twice in a non-ill-formed program. It sounds like we're not doing that, which satisfies my concern here. https://github.com/llvm/llvm-project/pull/100425 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits