summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-10-23 17:54:10 -0700
committerRichard Smith <richard@metafoo.co.uk>2019-10-24 14:58:29 -0700
commit70f59b5bbc84d195b4c7ee1597dcae4e73d3c479 (patch)
tree3ab997cf0cd33142c5ab9ded2cad4e6dacdfa8b5 /clang/test
parent33fca97880d3bd6ab4888b6eeb72bddff536e37a (diff)
downloadbcm5719-llvm-70f59b5bbc84d195b4c7ee1597dcae4e73d3c479.tar.gz
bcm5719-llvm-70f59b5bbc84d195b4c7ee1597dcae4e73d3c479.zip
When diagnosing an ambiguity, only note the candidates that contribute
to the ambiguity, rather than noting all viable candidates.
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp22
-rw-r--r--clang/test/CXX/drs/dr15xx.cpp31
-rw-r--r--clang/test/CXX/drs/dr16xx.cpp6
-rw-r--r--clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp2
-rw-r--r--clang/test/CXX/special/class.inhctor/p1.cpp10
-rw-r--r--clang/test/CXX/special/class.inhctor/p4.cpp4
-rw-r--r--clang/test/CXX/special/class.inhctor/p7.cpp2
-rw-r--r--clang/test/SemaCXX/ambig-user-defined-conversions.cpp2
-rw-r--r--clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp3
-rw-r--r--clang/test/SemaCXX/builtin-ptrtomember-overload-1.cpp2
-rw-r--r--clang/test/SemaCXX/copy-initialization.cpp2
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-constructor.cpp2
-rw-r--r--clang/test/SemaCXX/microsoft-vs-float128.cpp6
-rw-r--r--clang/test/SemaCXX/overload-call.cpp4
-rw-r--r--clang/test/SemaCXX/overload-member-call.cpp2
-rw-r--r--clang/test/SemaCXX/overloaded-builtin-operators.cpp6
-rw-r--r--clang/test/SemaTemplate/cxx1z-using-declaration.cpp8
-rw-r--r--clang/test/SemaTemplate/instantiate-expr-3.cpp2
-rw-r--r--clang/test/SemaTemplate/temp_arg_nontype.cpp4
19 files changed, 58 insertions, 62 deletions
diff --git a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
index 0c58da01be5..d64807ed5ab 100644
--- a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
+++ b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp
@@ -8,7 +8,7 @@ struct B2 {
B2(int); // expected-note {{candidate}}
};
-struct D1 : B1, B2 { // expected-note 2{{candidate}}
+struct D1 : B1, B2 {
using B1::B1; // expected-note {{inherited here}}
using B2::B2; // expected-note {{inherited here}}
};
@@ -35,11 +35,11 @@ namespace default_ctor {
operator D&&();
};
- struct A { // expected-note 2{{candidate}}
+ struct A {
A(); // expected-note {{candidate}}
- A(C &&); // expected-note {{candidate}}
- C &operator=(C&&); // expected-note {{candidate}}
+ A(C &&);
+ C &operator=(C&&);
A(D &&);
D &operator=(D&&); // expected-note {{candidate}}
@@ -47,11 +47,11 @@ namespace default_ctor {
A(convert_to_D2); // expected-note {{candidate}}
};
- struct B { // expected-note 2{{candidate}}
+ struct B {
B(); // expected-note {{candidate}}
- B(C &&); // expected-note {{candidate}}
- C &operator=(C&&); // expected-note {{candidate}}
+ B(C &&);
+ C &operator=(C&&);
B(D &&);
D &operator=(D&&); // expected-note {{candidate}}
@@ -66,14 +66,14 @@ namespace default_ctor {
using B::operator=;
};
struct D : A, B {
- using A::A; // expected-note 3{{inherited here}}
+ using A::A; // expected-note 2{{inherited here}}
using A::operator=;
- using B::B; // expected-note 3{{inherited here}}
+ using B::B; // expected-note 2{{inherited here}}
using B::operator=;
D(int);
- D(const D&); // expected-note {{candidate}}
- D &operator=(const D&); // expected-note {{candidate}}
+ D(const D&);
+ D &operator=(const D&);
};
C c;
diff --git a/clang/test/CXX/drs/dr15xx.cpp b/clang/test/CXX/drs/dr15xx.cpp
index bd714865eef..80a27e7863c 100644
--- a/clang/test/CXX/drs/dr15xx.cpp
+++ b/clang/test/CXX/drs/dr15xx.cpp
@@ -399,23 +399,20 @@ namespace dr1589 { // dr1589: 3.7 c++11
void g2() { f2({"foo","bar"}); } // chooses #4
namespace with_error {
- void f0(long); // #0 expected-note {{candidate function}}
- void f0(std::initializer_list<int>); // #00 expected-note {{candidate function}}
- void f0(std::initializer_list<int>, int = 0); // Makes selection of #00 ambiguous \
- // expected-note {{candidate function}}
- void g0() { f0({1L}); } // chooses #00 expected-error{{call to 'f0' is ambiguous}}
-
- void f1(int); // #1 expected-note {{candidate function}}
- void f1(std::initializer_list<long>); // #2 expected-note {{candidate function}}
- void f1(std::initializer_list<long>, int = 0); // Makes selection of #00 ambiguous \
- // expected-note {{candidate function}}
- void g1() { f1({42}); } // chooses #2 expected-error{{call to 'f1' is ambiguous}}
-
- void f2(std::pair<const char*, const char*>); // #3 TODO: expected- note {{candidate function}}
- void f2(std::initializer_list<std::string>); // #4 expected-note {{candidate function}}
- void f2(std::initializer_list<std::string>, int = 0); // Makes selection of #00 ambiguous \
- // expected-note {{candidate function}}
- void g2() { f2({"foo","bar"}); } // chooses #4 expected-error{{call to 'f2' is ambiguous}}
+ void f0(long); // #0
+ void f0(std::initializer_list<int>); // #00 expected-note {{candidate function}}
+ void f0(std::initializer_list<int>, int = 0); // expected-note {{candidate function}}
+ void g0() { f0({1L}); } // expected-error{{call to 'f0' is ambiguous}}
+
+ void f1(int); // #1
+ void f1(std::initializer_list<long>); // #2 expected-note {{candidate function}}
+ void f1(std::initializer_list<long>, int = 0); // expected-note {{candidate function}}
+ void g1() { f1({42}); } // expected-error{{call to 'f1' is ambiguous}}
+
+ void f2(std::pair<const char*, const char*>); // #3
+ void f2(std::initializer_list<std::string>); // #4 expected-note {{candidate function}}
+ void f2(std::initializer_list<std::string>, int = 0); // expected-note {{candidate function}}
+ void g2() { f2({"foo","bar"}); } // expected-error{{call to 'f2' is ambiguous}}
}
} // dr1589
diff --git a/clang/test/CXX/drs/dr16xx.cpp b/clang/test/CXX/drs/dr16xx.cpp
index 44d5b8f3f5b..3bbb1976364 100644
--- a/clang/test/CXX/drs/dr16xx.cpp
+++ b/clang/test/CXX/drs/dr16xx.cpp
@@ -111,13 +111,13 @@ namespace dr1638 { // dr1638: yes
namespace dr1645 { // dr1645: 3.9
#if __cplusplus >= 201103L
struct A {
- constexpr A(int, float = 0); // expected-note 2{{candidate}}
+ constexpr A(int, float = 0); // expected-note {{candidate}}
explicit A(int, int = 0); // expected-note 2{{candidate}}
A(int, int, int = 0) = delete; // expected-note {{candidate}}
};
- struct B : A { // expected-note 2{{candidate}}
- using A::A; // expected-note 5{{inherited here}}
+ struct B : A {
+ using A::A; // expected-note 4{{inherited here}}
};
constexpr B a(0); // expected-error {{ambiguous}}
diff --git a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp
index 4ed1d30b83d..2f895981b9b 100644
--- a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp
+++ b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp
@@ -2,7 +2,7 @@
namespace std_example {
template <class T> struct A {
- explicit A(const T &, ...) noexcept; // expected-note {{explicit}} expected-note 2{{candidate}}
+ explicit A(const T &, ...) noexcept; // expected-note {{explicit}}
A(T &&, ...); // expected-note 2{{candidate}}
};
diff --git a/clang/test/CXX/special/class.inhctor/p1.cpp b/clang/test/CXX/special/class.inhctor/p1.cpp
index 842b725cb0b..389f365b742 100644
--- a/clang/test/CXX/special/class.inhctor/p1.cpp
+++ b/clang/test/CXX/special/class.inhctor/p1.cpp
@@ -3,19 +3,19 @@
// Note: [class.inhctor] was removed by P0136R1. This tests the new behavior
// for the wording that used to be there.
-struct A { // expected-note 4{{candidate constructor (the implicit}}
- A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}}
+struct A {
+ A(...); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}
A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
- template<typename T> A(T, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
+ template<typename T> A(T, int = 0, ...);
template<typename T, int N> A(const T (&)[N]); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}
template<typename T, int N> A(const T (&)[N], int = 0); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}
};
-struct B : A { // expected-note 4{{candidate constructor (the implicit}}
- using A::A; // expected-note 15{{inherited here}}
+struct B : A {
+ using A::A; // expected-note 9{{inherited here}}
B(void*);
};
diff --git a/clang/test/CXX/special/class.inhctor/p4.cpp b/clang/test/CXX/special/class.inhctor/p4.cpp
index 69fbea3e0eb..a5d2cd74b50 100644
--- a/clang/test/CXX/special/class.inhctor/p4.cpp
+++ b/clang/test/CXX/special/class.inhctor/p4.cpp
@@ -60,13 +60,13 @@ H h2("foo"); // expected-error {{call to deleted constructor of 'H'}}
// same signature.
namespace DRnnnn {
struct A {
- constexpr A(int, float = 0) {} // expected-note {{candidate}}
+ constexpr A(int, float = 0) {}
explicit A(int, int = 0) {} // expected-note {{candidate}}
A(int, int, int = 0) = delete; // expected-note {{deleted}}
};
struct B : A {
- using A::A; // expected-note 3{{inherited here}}
+ using A::A; // expected-note 2{{inherited here}}
};
constexpr B b0(0, 0.0f); // ok, constexpr
diff --git a/clang/test/CXX/special/class.inhctor/p7.cpp b/clang/test/CXX/special/class.inhctor/p7.cpp
index 2d7acdcc2ce..4bbc2fc098a 100644
--- a/clang/test/CXX/special/class.inhctor/p7.cpp
+++ b/clang/test/CXX/special/class.inhctor/p7.cpp
@@ -9,7 +9,7 @@ struct B1 {
struct B2 {
B2(int); // expected-note {{candidate}}
};
-struct D1 : B1, B2 { // expected-note 2{{candidate}}
+struct D1 : B1, B2 {
using B1::B1; // expected-note {{inherited here}}
using B2::B2; // expected-note {{inherited here}}
};
diff --git a/clang/test/SemaCXX/ambig-user-defined-conversions.cpp b/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
index 276c1b07b5d..8d8fa4fef6d 100644
--- a/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
+++ b/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
@@ -13,7 +13,7 @@ namespace test0 {
extern B f();
B b1;
- void func(const int ci, const char cc); // expected-note {{candidate function}}
+ void func(const int ci, const char cc);
void func(const char ci, const B b); // expected-note {{candidate function}}
void func(const B b, const int ci); // expected-note {{candidate function}}
diff --git a/clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp b/clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp
index 61e347879a7..4330c0cc48a 100644
--- a/clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp
+++ b/clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp
@@ -17,11 +17,8 @@ struct C : B {
void foo(C c, int A::* pmf) {
- // FIXME. Why so many built-in candidates?
int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
- // expected-note {{built-in candidate operator->*(const struct A *, const int struct A::*)}} \
// expected-note {{built-in candidate operator->*(const struct A *, int struct A::*)}} \
- // expected-note {{built-in candidate operator->*(struct A *, const int struct A::*)}} \
// expected-note {{built-in candidate operator->*(struct A *, int struct A::*)}}
}
diff --git a/clang/test/SemaCXX/builtin-ptrtomember-overload-1.cpp b/clang/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
index 2d93c6b2dff..a717c283ab7 100644
--- a/clang/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
+++ b/clang/test/SemaCXX/builtin-ptrtomember-overload-1.cpp
@@ -42,5 +42,5 @@ void foo1(C1 c1, int A::* pmf) {
void foo1(C1 c1, int E::* pmf) {
int i = c1->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
// expected-note {{because of ambiguity in conversion of 'C1' to 'E *'}} \
- // expected-note 4 {{built-in candidate operator}}
+ // expected-note 2 {{built-in candidate operator}}
}
diff --git a/clang/test/SemaCXX/copy-initialization.cpp b/clang/test/SemaCXX/copy-initialization.cpp
index cd7e5f07e14..8866fe70db8 100644
--- a/clang/test/SemaCXX/copy-initialization.cpp
+++ b/clang/test/SemaCXX/copy-initialization.cpp
@@ -4,7 +4,7 @@
class X {
public:
- explicit X(const X&); // expected-note {{candidate constructor}}
+ explicit X(const X&);
X(int*); // expected-note 3{{candidate constructor}}
explicit X(float*); // expected-note {{candidate constructor}}
};
diff --git a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
index 870bbe5ce36..513c670d392 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
@@ -266,7 +266,7 @@ namespace PR12120 {
struct A { explicit A(int); A(float); }; // expected-note {{declared here}}
A a = { 0 }; // expected-error {{constructor is explicit}}
- struct B { explicit B(short); B(long); }; // expected-note 4{{candidate}}
+ struct B { explicit B(short); B(long); }; // expected-note 2{{candidate}}
B b = { 0 }; // expected-error {{ambiguous}}
struct C { explicit C(short); C(long); }; // expected-note 2{{candidate}}
diff --git a/clang/test/SemaCXX/microsoft-vs-float128.cpp b/clang/test/SemaCXX/microsoft-vs-float128.cpp
index d271e470032..77d24988129 100644
--- a/clang/test/SemaCXX/microsoft-vs-float128.cpp
+++ b/clang/test/SemaCXX/microsoft-vs-float128.cpp
@@ -11,7 +11,7 @@ template <typename T> struct is_same<T, T> { static constexpr bool value = true;
struct S {
- // The only numeric types S can be converted to is __int128 and __float128.
+ // The only numeric types S can be converted to are [unsigned] __int128 and __float128.
template <typename T, typename = typename enable_if<
!((__is_integral(T) && sizeof(T) != 16) ||
is_same<T, float>::value ||
@@ -29,6 +29,8 @@ void f() {
double d = S() + 1.0;
#ifndef MS
// expected-error@-2{{use of overloaded operator '+' is ambiguous}}
- // expected-note@-3 36{{built-in candidate operator+}}
+ // expected-note@-3 {{built-in candidate operator+(__float128, double)}}
+ // expected-note@-4 {{built-in candidate operator+(__int128, double)}}
+ // expected-note@-5 {{built-in candidate operator+(unsigned __int128, double)}}
#endif
}
diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp
index befa927f067..a34bce5014a 100644
--- a/clang/test/SemaCXX/overload-call.cpp
+++ b/clang/test/SemaCXX/overload-call.cpp
@@ -12,9 +12,9 @@ void test_f(int iv, float fv) {
}
int* g(int, float, int); // expected-note {{candidate function}}
-float* g(int, int, int); // expected-note {{candidate function}}
+float* g(int, int, int);
double* g(int, float, float); // expected-note {{candidate function}}
-char* g(int, float, ...); // expected-note {{candidate function}}
+char* g(int, float, ...);
void g();
void test_g(int iv, float fv) {
diff --git a/clang/test/SemaCXX/overload-member-call.cpp b/clang/test/SemaCXX/overload-member-call.cpp
index 2d017a499ad..41f3946de0b 100644
--- a/clang/test/SemaCXX/overload-member-call.cpp
+++ b/clang/test/SemaCXX/overload-member-call.cpp
@@ -14,7 +14,7 @@ struct X {
int& g(int) const; // expected-note 2 {{candidate function}}
float& g(int); // expected-note 2 {{candidate function}}
- static double& g(double); // expected-note 2 {{candidate function}}
+ static double& g(double);
void h(int);
diff --git a/clang/test/SemaCXX/overloaded-builtin-operators.cpp b/clang/test/SemaCXX/overloaded-builtin-operators.cpp
index 4fa376aed03..d237dfe6c09 100644
--- a/clang/test/SemaCXX/overloaded-builtin-operators.cpp
+++ b/clang/test/SemaCXX/overloaded-builtin-operators.cpp
@@ -194,10 +194,9 @@ struct A {
};
void test_dr425(A a) {
- // FIXME: lots of candidates here!
(void)(1.0f * a); // expected-error{{ambiguous}} \
// expected-note 4{{candidate}} \
- // expected-note {{remaining 140 candidates omitted; pass -fshow-overloads=all to show them}}
+ // expected-note {{remaining 8 candidates omitted; pass -fshow-overloads=all to show them}}
}
// pr5432
@@ -237,9 +236,10 @@ namespace PR8477 {
(void)(foo - zero);
(void)(zero + foo);
(void)(zero[foo]);
+ // FIXME: It would be nice to report fewer candidates here.
(void)(foo - foo); // expected-error{{use of overloaded operator '-' is ambiguous}} \
// expected-note 4{{built-in candidate operator-}} \
- // expected-note{{candidates omitted}}
+ // expected-note{{142 candidates omitted}}
return foo[zero] == zero;
}
}
diff --git a/clang/test/SemaTemplate/cxx1z-using-declaration.cpp b/clang/test/SemaTemplate/cxx1z-using-declaration.cpp
index 87ca748f8fd..ba5918ce098 100644
--- a/clang/test/SemaTemplate/cxx1z-using-declaration.cpp
+++ b/clang/test/SemaTemplate/cxx1z-using-declaration.cpp
@@ -16,7 +16,7 @@ void test_Unexpanded() {
}
// Test using non-type members from pack of base classes.
-template<typename ...T> struct A : T... { // expected-note 2{{candidate}}
+template<typename ...T> struct A : T... {
using T::T ...; // expected-note 2{{inherited here}}
using T::operator() ...;
using T::operator T* ...;
@@ -41,7 +41,7 @@ namespace test_A {
Y(int, int);
void operator()(int, int);
operator Y *();
- void h(int, int); // expected-note {{not viable}}
+ void h(int, int);
};
struct Z {
Z();
@@ -177,14 +177,14 @@ namespace test_lambda1 {
};
struct B {
template<typename> struct X {
- void f(int, int); // expected-note {{declared here}} expected-note {{not viable}}
+ void f(int, int); // expected-note {{declared here}}
using type = int;
};
};
struct C {
template<typename> struct X {
void f(int); // expected-note {{candidate}}
- void f(int, int); // expected-note {{not viable}}
+ void f(int, int);
using type = int;
};
};
diff --git a/clang/test/SemaTemplate/instantiate-expr-3.cpp b/clang/test/SemaTemplate/instantiate-expr-3.cpp
index 90c322cbf37..142e4ebcedc 100644
--- a/clang/test/SemaTemplate/instantiate-expr-3.cpp
+++ b/clang/test/SemaTemplate/instantiate-expr-3.cpp
@@ -23,7 +23,7 @@ namespace N1 {
}
namespace N2 {
- long& operator+=(N1::X&, long); // expected-note{{candidate}}
+ long& operator+=(N1::X&, long);
template<typename T, typename U, typename Result>
struct PlusEquals0 {
diff --git a/clang/test/SemaTemplate/temp_arg_nontype.cpp b/clang/test/SemaTemplate/temp_arg_nontype.cpp
index 330a954e0dd..08ed7d5004a 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype.cpp
@@ -445,10 +445,10 @@ namespace nondependent_default_arg_ordering {
template<typename A> void f(X<A>); // expected-note {{candidate}}
template<typename A> void f(X<A, &m>); // expected-note {{candidate}}
template<typename A, A B> void f(X<A, B>); // expected-note 2{{candidate}}
- template<template<typename U, U> class T, typename A, int *B> void f(T<A, B>); // expected-note 2{{candidate}}
+ template<template<typename U, U> class T, typename A, int *B> void f(T<A, B>);
void g() {
// FIXME: The first and second function templates above should be
- // considered more specialized than the last two, but during partial
+ // considered more specialized than the third, but during partial
// ordering we fail to check that we actually deduced template arguments
// that make the deduced A identical to A.
X<int *, &n> x; f(x); // expected-error {{ambiguous}}
OpenPOWER on IntegriCloud