From b23c5e8c3df850177449268c5ca7dbf986157525 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 9 May 2019 03:31:27 +0000 Subject: [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308 --- clang/lib/Serialization/ASTReader.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Serialization/ASTReader.cpp') diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 64af0fa8a1d..a09507f6daa 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8745,6 +8745,11 @@ ASTReader::ReadTemplateName(ModuleFile &F, const RecordData &Record, return Context.getOverloadedTemplateName(Decls.begin(), Decls.end()); } + case TemplateName::AssumedTemplate: { + DeclarationName Name = ReadDeclarationName(F, Record, Idx); + return Context.getAssumedTemplateName(Name); + } + case TemplateName::QualifiedTemplate: { NestedNameSpecifier *NNS = ReadNestedNameSpecifier(F, Record, Idx); bool hasTemplKeyword = Record[Idx++]; -- cgit v1.2.3