diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-22 00:20:18 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-22 00:20:18 +0000 |
commit | a41a8c5972c2632247ae7913cf6ce65d45f7e702 (patch) | |
tree | 227fcd37c3bb59135e62dd3457712b93bb225cd4 /test/SemaTemplate/default-expr-arguments.cpp | |
parent | 128317e6a0b020966f7392aa850b24cfe43bc163 (diff) |
Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:
t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
type 'int *' [-pedantic]
f(long_ptr);
^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
^
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102038 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/default-expr-arguments.cpp')
-rw-r--r-- | test/SemaTemplate/default-expr-arguments.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index d2cc45b035..40b7f2b3cf 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -7,7 +7,8 @@ C<char>::C(int a0); 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}} +template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}} \ +// expected-note{{passing argument to parameter 'b' here}} template<typename T> void f2(T a, T b = T()) { } @@ -25,8 +26,10 @@ void g() { } template<typename T> struct F { - F(T t = 10); // expected-error{{no viable conversion}} - void f(T t = 10); // expected-error{{no viable conversion}} + F(T t = 10); // expected-error{{no viable conversion}} \ + // expected-note{{passing argument to parameter 't' here}} + void f(T t = 10); // expected-error{{no viable conversion}} \ + // expected-note{{passing argument to parameter 't' here}} }; struct FD : F<int> { }; @@ -99,7 +102,8 @@ void test_x2(X2<int> x2i, X2<NotDefaultConstructible> x2n) { // PR5283 namespace PR5283 { template<typename T> struct A { - A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}} + A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}} \ + // expected-note 3{{passing argument to parameter here}} }; struct B : A<int*> { |