]> granicus.if.org Git - clang/commit
[c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whose
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 9 May 2019 03:31:27 +0000 (03:31 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 9 May 2019 03:31:27 +0000 (03:31 +0000)
commitfb98e7c13da639f34f34830a4e675367e0816cb6
tree70e025e9b4a31559d1f061e72439b5414537ad3b
parent70cd574857c6023b8c60e325c4029a23f716c2dd
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360308 91177308-0d34-0410-b5e6-96231b3b80d8
52 files changed:
include/clang/AST/ASTContext.h
include/clang/AST/DeclarationName.h
include/clang/AST/TemplateName.h
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/TemplateKinds.h
include/clang/Parse/Parser.h
include/clang/Sema/Sema.h
lib/AST/ASTContext.cpp
lib/AST/ASTImporter.cpp
lib/AST/ASTStructuralEquivalence.cpp
lib/AST/ItaniumMangle.cpp
lib/AST/ODRHash.cpp
lib/AST/TemplateName.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseTemplate.cpp
lib/Parse/ParseTentative.cpp
lib/Parse/Parser.cpp
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplate.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp
test/CXX/drs/dr2xx.cpp
test/CXX/drs/dr6xx.cpp
test/CXX/temp/temp.spec/temp.explicit/p5.cpp
test/FixIt/typo-crash.cpp
test/Misc/diag-template-diffing.cpp
test/Modules/module-private.cpp
test/Modules/submodules-merge-defs.cpp
test/Parser/cxx-ambig-init-templ.cpp
test/Parser/cxx-template-argument.cpp
test/Parser/cxx-template-decl.cpp
test/SemaCXX/alias-template.cpp
test/SemaCXX/class.cpp
test/SemaCXX/cxx2a-adl-only-template-id.cpp [new file with mode: 0644]
test/SemaCXX/destructor.cpp
test/SemaCXX/invalid-member-expr.cpp
test/SemaCXX/typo-correction.cpp
test/SemaTemplate/dependent-base-classes.cpp
test/SemaTemplate/dependent-template-recover.cpp
test/SemaTemplate/rdar9173693.cpp
test/SemaTemplate/recovery-crash.cpp
tools/libclang/CIndex.cpp
www/cxx_status.html