commit 02b8944317de822b7d231fd4d3ec7f0d367821c8
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 14 10:08:22 2010 -0400
* call.c (convert_like_real): Give "initializing argument of"
information for ambiguous conversion. Give source position
of function.
@@ -4934,7 +4934,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{
permerror (input_location, "invalid conversion from %qT to %qT", TREE_TYPE (expr), totype);
if (fn)
- permerror (input_location, " initializing argument %P of %qD", argnum, fn);
+ permerror (DECL_SOURCE_LOCATION (fn),
+ " initializing argument %P of %qD", argnum, fn);
}
else
return error_mark_node;
@@ -5018,11 +5019,14 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
}
return expr;
case ck_ambig:
- if (!(complain & tf_error))
- return error_mark_node;
- /* Call build_user_type_conversion again for the error. */
- return build_user_type_conversion
- (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (complain & tf_error)
+ {
+ /* Call build_user_type_conversion again for the error. */
+ build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL);
+ if (fn)
+ error (" initializing argument %P of %q+D", argnum, fn);
+ }
+ return error_mark_node;
case ck_list:
{
@@ -5110,7 +5114,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (diag_kind && fn)
{
if ((complain & tf_error))
- emit_diagnostic (diag_kind, input_location, 0,
+ emit_diagnostic (diag_kind, DECL_SOURCE_LOCATION (fn), 0,
" initializing argument %P of %qD", argnum, fn);
else if (diag_kind == DK_ERROR)
return error_mark_node;
@@ -1,5 +1,8 @@
// { dg-options "-std=c++0x" }
+// Just discard errors pointing at header files
+// { dg-prune-output "include" }
+
#include <vector>
#include <typeinfo>
@@ -1,8 +1,10 @@
// { dg-options "-std=c++0x" }
+// Allow other errors, too
+// { dg-prune-output "error" }
+
void f(double);
int main()
{
f({{1}}); // { dg-error "too many braces" }
- // { dg-error "" "" { target *-*-* } 6 } allow other errors, too
}
@@ -3,11 +3,11 @@
struct A
{
- A(void*);
+ A(void*); // { dg-error "initializing" }
~A();
};
void foo(const int i, bool b)
{
- b ? A(0) : i; // { dg-error "conversion|initializing" }
+ b ? A(0) : i; // { dg-error "conversion" }
}
@@ -16,7 +16,7 @@
struct t_0_st_0;
-struct t_0_st_1 {
+struct t_0_st_1 { // { dg-error "initializing" }
int member;
t_0_st_1 (t_0_st_0&);// { dg-message "note" }
@@ -83,7 +83,7 @@ void t_1_local_init ()
struct t_2_st_0;
-struct t_2_st_1 {
+struct t_2_st_1 { // { dg-error "initializing" }
int member;
t_2_st_1 (t_2_st_0); // { dg-message "note" }
@@ -92,12 +92,7 @@ void test01(void) {
}
// { dg-error "invalid conversion " "" { target *-*-* } 314 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 314 }
// { dg-error "invalid conversion " "" { target *-*-* } 308 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 308 }
// { dg-error "invalid conversion " "" { target *-*-* } 331 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 331 }
// { dg-error "invalid conversion " "" { target *-*-* } 339 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 339 }
// { dg-excess-errors "In constructor" }
-