diff options
author | John McCall <rjmccall@apple.com> | 2010-01-13 00:25:19 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-01-13 00:25:19 +0000 |
commit | 220ccbf2c9ef97034cce80561f9f46c4f1f63bc7 (patch) | |
tree | da32b58080875bda1362c4475b624aa9e388b346 /test | |
parent | dd6bcc5f79666b9298d91a0a6ee7a0b537bde601 (diff) | |
download | clang-220ccbf2c9ef97034cce80561f9f46c4f1f63bc7.tar.gz |
Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable. There's a lot we can do to improve this, but
it's a good start. Further improvements should probably be integrated with the
bad-initialization reporting routines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
21 files changed, 25 insertions, 25 deletions
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp index 34ce546656..cf3db5175f 100644 --- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp +++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s struct Base { }; // expected-note{{candidate is the implicit copy constructor}} -struct Derived : Base { }; // expected-note{{candidate is the implicit copy constructor}} +struct Derived : Base { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} struct Unrelated { }; struct Derived2 : Base { }; struct Diamond : Derived, Derived2 { }; diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp index 6f23e78c1c..9fc4a5809f 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp @@ -14,7 +14,7 @@ struct InitOkay { InitOkay(int) { } }; -struct CannotInit { }; // expected-note{{candidate is the implicit copy constructor}} +struct CannotInit { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} int &returnInt() { return X<int>::value; } float &returnFloat() { return X<float>::value; } diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp index e281150241..2eae1125c0 100644 --- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp +++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp @@ -12,7 +12,7 @@ struct X1 { X1(int); }; -struct X2 { }; // expected-note{{candidate is the implicit copy constructor}} +struct X2 { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} int& get_int() { return X0<int>::value; } X1& get_X1() { return X0<X1>::value; } diff --git a/test/CXX/temp/temp.param/p3.cpp b/test/CXX/temp/temp.param/p3.cpp index a48702d662..8fcc2dc859 100644 --- a/test/CXX/temp/temp.param/p3.cpp +++ b/test/CXX/temp/temp.param/p3.cpp @@ -15,7 +15,7 @@ template<template<class T> class Y> struct X1 { // could be interpreted as either a non-type template-parameter or a // type-parameter (because its identifier is the name of an already // existing class) is taken as a type-parameter. For example, -class T { /* ... */ }; // expected-note{{candidate is the implicit copy constructor}} +class T { /* ... */ }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}} int i; template<class T, T i> struct X2 { diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp index 29045cc860..772aef6b58 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate is the implicit copy constructor}} +struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate constructor (the implicit copy constructor)}} IntHolder(int); // expected-note 2{{candidate constructor}} }; diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp index eb729ff676..b42633924e 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p1.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p1.cpp @@ -48,7 +48,7 @@ template void X1<int>::f<>(int&, int*); // expected-note{{instantiation}} // Explicitly instantiate members of a class template struct Incomplete; // expected-note{{forward declaration}} -struct NonDefaultConstructible { // expected-note{{candidate is the implicit copy constructor}} +struct NonDefaultConstructible { // expected-note{{candidate constructor (the implicit copy constructor) not viable}} NonDefaultConstructible(int); // expected-note{{candidate constructor}} }; diff --git a/test/SemaCXX/condition.cpp b/test/SemaCXX/condition.cpp index 7931d11d14..fe802d0555 100644 --- a/test/SemaCXX/condition.cpp +++ b/test/SemaCXX/condition.cpp @@ -16,8 +16,8 @@ void test() { for (;s;) ; // expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} switch (s) {} // expected-error {{statement requires expression of integer type ('struct S' invalid)}} - while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} expected-note{{candidate is the implicit copy constructor}} - while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}} expected-note{{candidate is the implicit copy constructor}} + while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} expected-note{{candidate constructor (the implicit copy constructor)}} + while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}} expected-note{{candidate constructor (the implicit copy constructor)}} switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{cannot initialize}} if (int x=0) { // expected-note 2 {{previous definition is here}} diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp index ecab4e47fd..53f057ed0f 100644 --- a/test/SemaCXX/constructor-initializer.cpp +++ b/test/SemaCXX/constructor-initializer.cpp @@ -97,7 +97,7 @@ struct Current : Derived { // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}} }; -struct M { // expected-note 2 {{candidate is the implicit copy constructor}} \ +struct M { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} \ // expected-note {{declared here}} \ // expected-note {{declared here}} M(int i, int j); // expected-note 2 {{candidate constructor}} diff --git a/test/SemaCXX/converting-constructor.cpp b/test/SemaCXX/converting-constructor.cpp index 3ef003ce76..1688e51e73 100644 --- a/test/SemaCXX/converting-constructor.cpp +++ b/test/SemaCXX/converting-constructor.cpp @@ -27,7 +27,7 @@ public: FromShort(short s); }; -class FromShortExplicitly { // expected-note{{candidate is the implicit copy constructor}} +class FromShortExplicitly { // expected-note{{candidate constructor (the implicit copy constructor)}} public: explicit FromShortExplicitly(short s); }; diff --git a/test/SemaCXX/dcl_init_aggr.cpp b/test/SemaCXX/dcl_init_aggr.cpp index f928626a03..07ddb0add2 100644 --- a/test/SemaCXX/dcl_init_aggr.cpp +++ b/test/SemaCXX/dcl_init_aggr.cpp @@ -40,7 +40,7 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 }; // expected-error{{excess elements in ar struct TooFew { int a; char* b; int c; }; TooFew too_few = { 1, "asdf" }; // okay -struct NoDefaultConstructor { // expected-note 3 {{candidate is the implicit copy constructor}} \ +struct NoDefaultConstructor { // expected-note 3 {{candidate constructor (the implicit copy constructor)}} \ // expected-note{{declared here}} NoDefaultConstructor(int); // expected-note 3 {{candidate constructor}} }; @@ -115,7 +115,7 @@ B2 b2_2 = { 4, d2, 0 }; B2 b2_3 = { c2, a2, a2 }; // C++ [dcl.init.aggr]p15: -union u { int a; char* b; }; // expected-note{{candidate is the implicit copy constructor}} +union u { int a; char* b; }; // expected-note{{candidate constructor (the implicit copy constructor)}} u u1 = { 1 }; u u2 = u1; u u3 = 1; // expected-error{{no viable conversion}} diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp index bc1cde5827..6601a3dd0d 100644 --- a/test/SemaCXX/direct-initializer.cpp +++ b/test/SemaCXX/direct-initializer.cpp @@ -13,14 +13,14 @@ class Y { explicit Y(float); }; -class X { // expected-note{{candidate is the implicit copy constructor}} +class X { // expected-note{{candidate constructor (the implicit copy constructor)}} public: explicit X(int); // expected-note{{candidate constructor}} X(float, float, float); // expected-note{{candidate constructor}} X(float, Y); // expected-note{{candidate constructor}} }; -class Z { // expected-note{{candidate is the implicit copy constructor}} +class Z { // expected-note{{candidate constructor (the implicit copy constructor)}} public: Z(int); // expected-note{{candidate constructor}} }; diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp index 946d4713f7..0bef0cd6be 100644 --- a/test/SemaCXX/functional-cast.cpp +++ b/test/SemaCXX/functional-cast.cpp @@ -10,7 +10,7 @@ struct InitViaConstructor { InitViaConstructor(int i = 7); }; -struct NoValueInit { // expected-note 2 {{candidate is the implicit copy constructor}} +struct NoValueInit { // expected-note 2 {{candidate constructor (the implicit copy constructor)}} NoValueInit(int i, int j); // expected-note 2 {{candidate constructor}} }; diff --git a/test/SemaCXX/namespace.cpp b/test/SemaCXX/namespace.cpp index 38b31f721a..2a9d31fa94 100644 --- a/test/SemaCXX/namespace.cpp +++ b/test/SemaCXX/namespace.cpp @@ -9,7 +9,7 @@ int A; // expected-error {{redefinition of 'A' as different kind of symbol}} class A; // expected-error {{redefinition of 'A' as different kind of symbol}} class B {}; // expected-note {{previous definition is here}} \ - // expected-note{{candidate is the implicit copy assignment operator}} + // expected-note{{candidate function (the implicit copy assignment operator)}} void C(); // expected-note {{previous definition is here}} namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}} diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index a53231dca7..8618f0339b 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -178,7 +178,7 @@ bool (foo_S::value); namespace somens { - struct a { }; // expected-note{{candidate is the implicit copy constructor}} + struct a { }; // expected-note{{candidate constructor (the implicit copy constructor)}} } template <typename T> diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 42bf029bd0..fbd26b2fd8 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -304,7 +304,7 @@ namespace PR5756 { // Tests the exact text used to note the candidates namespace test1 { - template <class T> void foo(T t, unsigned N); // expected-note {{candidate function template specialization [with T = int]}} + template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int]}} void foo(int n, char N); // expected-note {{candidate function}} void test() { diff --git a/test/SemaCXX/overloaded-builtin-operators.cpp b/test/SemaCXX/overloaded-builtin-operators.cpp index e9ffc2ad3f..61c2e2110a 100644 --- a/test/SemaCXX/overloaded-builtin-operators.cpp +++ b/test/SemaCXX/overloaded-builtin-operators.cpp @@ -59,7 +59,7 @@ void f(Short s, Long l, Enum1 e1, Enum2 e2, Xpmf pmf) { // FIXME: should pass (void)static_cast<no&>(islong(e1 % e2)); } -struct ShortRef { // expected-note{{candidate is the implicit copy assignment operator}} +struct ShortRef { // expected-note{{candidate function (the implicit copy assignment operator)}} operator short&(); }; @@ -67,7 +67,7 @@ struct LongRef { operator volatile long&(); }; -struct XpmfRef { // expected-note{{candidate is the implicit copy assignment operator}} +struct XpmfRef { // expected-note{{candidate function (the implicit copy assignment operator)}} operator pmf&(); }; diff --git a/test/SemaTemplate/ambiguous-ovl-print.cpp b/test/SemaTemplate/ambiguous-ovl-print.cpp index 17f412f671..7e3fa24197 100644 --- a/test/SemaTemplate/ambiguous-ovl-print.cpp +++ b/test/SemaTemplate/ambiguous-ovl-print.cpp @@ -2,7 +2,7 @@ void f(void*, int); // expected-note{{candidate function}} template<typename T> - void f(T*, long); // expected-note{{candidate function template}} + void f(T*, long); // expected-note{{candidate function}} void test_f(int *ip, int i) { f(ip, i); // expected-error{{ambiguous}} diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 9ec2e9e0fe..131b80cb1f 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -5,7 +5,7 @@ class C { C(int a0 = 0); }; template<> C<char>::C(int a0); -struct S { }; // expected-note 3 {{candidate is the implicit copy constructor}} +struct S { }; // expected-note 3 {{candidate constructor (the implicit copy constructor)}} template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}} diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp index c42ce26240..227856f1a8 100644 --- a/test/SemaTemplate/explicit-instantiation.cpp +++ b/test/SemaTemplate/explicit-instantiation.cpp @@ -25,7 +25,7 @@ T X0<T>::value; // expected-error{{no matching constructor}} template int X0<int>::value; -struct NotDefaultConstructible { // expected-note{{candidate is the implicit copy constructor}} +struct NotDefaultConstructible { // expected-note{{candidate constructor (the implicit copy constructor)}} NotDefaultConstructible(int); // expected-note{{candidate constructor}} }; diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp index b17a0faf7c..1c9b232f6d 100644 --- a/test/SemaTemplate/fun-template-def.cpp +++ b/test/SemaTemplate/fun-template-def.cpp @@ -8,7 +8,7 @@ // Fake typeid, lacking a typeinfo header. namespace std { class type_info {}; } -struct dummy {}; // expected-note 3 {{candidate is the implicit copy constructor}} +struct dummy {}; // expected-note 3 {{candidate constructor (the implicit copy constructor)}} template<typename T> int f0(T x) { diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp index 06fd2296c6..428ef1ba87 100644 --- a/test/SemaTemplate/instantiate-expr-4.cpp +++ b/test/SemaTemplate/instantiate-expr-4.cpp @@ -21,7 +21,7 @@ struct FunctionalCast0 { template struct FunctionalCast0<5>; -struct X { // expected-note 3 {{candidate is the implicit copy constructor}} +struct X { // expected-note 3 {{candidate constructor (the implicit copy constructor)}} X(int, int); // expected-note 3 {{candidate constructor}} }; |