summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:31:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:31:27 +0000
commitb23c5e8c3df850177449268c5ca7dbf986157525 (patch)
tree676dabf23d28ebd62d0f453558f8874ea7eafe29 /clang/test/Modules
parenta438a898b02a93a0179be1dd5ed67fb5b01dcf6b (diff)
downloadbcm5719-llvm-b23c5e8c3df850177449268c5ca7dbf986157525.tar.gz
bcm5719-llvm-b23c5e8c3df850177449268c5ca7dbf986157525.zip
[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
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/module-private.cpp4
-rw-r--r--clang/test/Modules/submodules-merge-defs.cpp4
2 files changed, 3 insertions, 5 deletions
diff --git a/clang/test/Modules/module-private.cpp b/clang/test/Modules/module-private.cpp
index 42ab185760b..30957865d1c 100644
--- a/clang/test/Modules/module-private.cpp
+++ b/clang/test/Modules/module-private.cpp
@@ -18,9 +18,7 @@ int test_broken() {
int *ip = 0;
f1(ip); // expected-error{{use of undeclared identifier 'f1'}}
- vector<int> vec; // expected-error{{use of undeclared identifier 'vector'}} \
- // expected-error{{expected '(' for function-style cast or type construction}} \
- // expected-error{{use of undeclared identifier 'vec'}}
+ vector<int> vec; // expected-error{{no template named 'vector'}}
VisibleStruct vs;
vs.field = 0; // expected-error{{no member named 'field' in 'VisibleStruct'}}
diff --git a/clang/test/Modules/submodules-merge-defs.cpp b/clang/test/Modules/submodules-merge-defs.cpp
index 795150208c9..0f7637de573 100644
--- a/clang/test/Modules/submodules-merge-defs.cpp
+++ b/clang/test/Modules/submodules-merge-defs.cpp
@@ -29,7 +29,7 @@ B::Inner2 pre_bi; // expected-error +{{must be imported}}
// expected-note@defs.h:4 +{{here}}
// expected-note@defs.h:17 +{{here}}
void pre_bfi(B b) { // expected-error +{{must be imported}}
- b.f<int>(); // expected-error +{{}}
+ b.f<int>();
}
C_Base<1> pre_cb1; // expected-error +{{must be imported}}
@@ -48,7 +48,7 @@ int pre_e = E(0); // expected-error {{must be imported}}
// expected-note@defs.h:32 +{{here}}
int pre_ff = F<int>().f(); // expected-error +{{must be imported}}
-int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}} expected-error 2{{expected}}
+int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}}
// expected-note@defs.h:34 +{{here}}
G::A pre_ga // expected-error +{{must be imported}}
OpenPOWER on IntegriCloud