Introduce a centralized routine in Sema for diagnosing failed lookups (when
used as expressions). In dependent contexts, try to recover by doing a lookup
in previously-dependent base classes. We get better diagnostics out, but
unfortunately the recovery fails: we need to turn it into a method call
expression, not a bare call expression. Thus this is still a WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91525 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
index 456a785..b59e6ca 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
@@ -32,7 +32,7 @@
namespace Test {
void test() {
func(A::A());
- func(B::B()); // expected-error {{ no matching function for call to 'func' }}
+ func(B::B()); // expected-error {{use of undeclared identifier 'func'}}
func(C::C());
A::A() + A::A();
B::B() + B::B();
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
index d0cb42d..2530f12 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<class X, class Y, class Z> X f(Y,Z);
+template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate function}}
void g() {
f<int,char*,double>("aa",3.0);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
index d03e346..bcfb71c 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp
@@ -15,7 +15,7 @@
f1(ip, fv);
}
-template<typename T> void f2(T*, T*);
+template<typename T> void f2(T*, T*); // expected-note 2 {{candidate function}}
struct ConvToIntPtr {
operator int*() const;
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index d74bd2e..997e19c 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -9,7 +9,7 @@
}
float g() {
- return operator float(); // expected-error{{no matching function for call to 'operator float'}}
+ return operator float(); // expected-error{{use of undeclared 'operator float'}}
}
};
diff --git a/test/SemaCXX/decltype-crash.cpp b/test/SemaCXX/decltype-crash.cpp
index fa98e75..f94ba45 100644
--- a/test/SemaCXX/decltype-crash.cpp
+++ b/test/SemaCXX/decltype-crash.cpp
@@ -3,5 +3,5 @@
int& a();
void f() {
- decltype(a()) c; // expected-error {{no matching function for call to 'decltype'}}
+ decltype(a()) c; // expected-error {{use of undeclared identifier 'decltype'}}
}
diff --git a/test/SemaCXX/no-implicit-builtin-decls.cpp b/test/SemaCXX/no-implicit-builtin-decls.cpp
index 18c603a..d82f7f1 100644
--- a/test/SemaCXX/no-implicit-builtin-decls.cpp
+++ b/test/SemaCXX/no-implicit-builtin-decls.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
- void *p = malloc(sizeof(int) * 10); // expected-error{{no matching function for call to 'malloc'}}
+ void *p = malloc(sizeof(int) * 10); // expected-error{{use of undeclared identifier 'malloc'}}
}
int malloc(double);
diff --git a/test/SemaCXX/type-dependent-exprs.cpp b/test/SemaCXX/type-dependent-exprs.cpp
index ba11581..abe1b4d 100644
--- a/test/SemaCXX/type-dependent-exprs.cpp
+++ b/test/SemaCXX/type-dependent-exprs.cpp
@@ -19,6 +19,6 @@
return g(x);
h(x); // h is a dependent name
g(1, 1); // expected-error{{no matching function for call}}
- h(1); // expected-error{{no matching function for call to 'h'}}
+ h(1); // expected-error{{use of undeclared identifier 'h'}}
return 0;
}
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp
index 6fed9ed..68aaa64 100644
--- a/test/SemaTemplate/constructor-template.cpp
+++ b/test/SemaTemplate/constructor-template.cpp
@@ -1,11 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X0 { // expected-note{{candidate}}
X0(int); // expected-note{{candidate}}
- template<typename T> X0(T);
- template<typename T, typename U> X0(T*, U*);
+ template<typename T> X0(T); // expected-note {{candidate}}
+ template<typename T, typename U> X0(T*, U*); // expected-note {{candidate}}
// PR4761
- template<typename T> X0() : f0(T::foo) {}
+ template<typename T> X0() : f0(T::foo) {} // expected-note {{candidate}}
int f0;
};
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index f73af59..fbe78e2 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -84,3 +84,18 @@
d2.test3(); // expected-note {{in instantiation of member function}}
}
}
+
+namespace test1 {
+ template <class T> struct Base {
+ void foo(T); // expected-note {{must qualify identifier to find this declaration in dependent base class}}
+ };
+
+ template <class T> struct Derived : Base<T> {
+ void doFoo(T v) {
+ // FIXME: the second error here is from a broken recovery attempt
+ foo(v); // expected-error {{use of undeclared identifier}} expected-error {{call to non-static member function without an object}}
+ }
+ };
+
+ template struct Derived<int>; // expected-note {{requested here}}
+}
diff --git a/test/SemaTemplate/instantiate-call.cpp b/test/SemaTemplate/instantiate-call.cpp
index a40364a..ad06be3 100644
--- a/test/SemaTemplate/instantiate-call.cpp
+++ b/test/SemaTemplate/instantiate-call.cpp
@@ -24,7 +24,7 @@
template<typename T, typename Result>
struct call_f0 {
void test_f0(T t) {
- Result &result = f0(t); // expected-error 2{{no matching}}
+ Result &result = f0(t); // expected-error 2{{undeclared identifier}}
}
};
}
diff --git a/test/SemaTemplate/recursive-template-instantiation.cpp b/test/SemaTemplate/recursive-template-instantiation.cpp
index e86196c..0ddedaf 100644
--- a/test/SemaTemplate/recursive-template-instantiation.cpp
+++ b/test/SemaTemplate/recursive-template-instantiation.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> void f(T* t) {
+template<typename T> void f(T* t) { // expected-note{{candidate function}}
f(*t); // expected-error{{no matching function}}\
// expected-note 3{{requested here}}
}