===================================================================
@@ -1212,10 +1212,11 @@ add_method (tree type, tree method, bool via_using
continue;
}
error_at (DECL_SOURCE_LOCATION (method),
- "%q#D", method);
- error_at (DECL_SOURCE_LOCATION (fn),
- "conflicts with version inherited from %qT",
- basef);
+ "%q#D conflicts with version inherited from %qT",
+ method, basef);
+ inform (DECL_SOURCE_LOCATION (fn),
+ "version inherited from %qT declared here",
+ basef);
}
/* Otherwise defer to the other function. */
return false;
@@ -1233,8 +1234,10 @@ add_method (tree type, tree method, bool via_using
}
else
{
- error ("%q+#D cannot be overloaded", method);
- error ("with %q+#D", fn);
+ error_at (DECL_SOURCE_LOCATION (method),
+ "%q#D cannot be overloaded with %q#D", method, fn);
+ inform (DECL_SOURCE_LOCATION (fn),
+ "previous declaration %q#D", fn);
return false;
}
}
@@ -1366,16 +1369,21 @@ handle_using_decl (tree using_decl, tree t)
the same name already present in the current class. */;
else
{
- error ("%q+D invalid in %q#T", using_decl, t);
- error (" because of local method %q+#D with same name",
- old_value);
+ error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T "
+ "because of local method %q#D with same name",
+ using_decl, t, old_value);
+ inform (DECL_SOURCE_LOCATION (old_value),
+ "local method %q#D declared here", old_value);
return;
}
}
else if (!DECL_ARTIFICIAL (old_value))
{
- error ("%q+D invalid in %q#T", using_decl, t);
- error (" because of local member %q+#D with same name", old_value);
+ error_at (DECL_SOURCE_LOCATION (using_decl), "%qD invalid in %q#T "
+ "because of local member %q#D with same name",
+ using_decl, t, old_value);
+ inform (DECL_SOURCE_LOCATION (old_value),
+ "local member %q#D declared here", old_value);
return;
}
===================================================================
@@ -8,7 +8,7 @@ struct B2 {
B2(int);
};
struct D1 : B1, B2 {
- using B1::B1; // { dg-error "inherited" }
+ using B1::B1; // { dg-message "declared" }
using B2::B2; // { dg-error "inherited" }
}; // ill-formed: attempts to declare D1(int) twice
struct D2 : B1, B2 {
===================================================================
@@ -4,6 +4,6 @@
template<int N> struct B { };
template<typename... T> struct A
{
- B<sizeof...(T)> f(); // { dg-error "sizeof\\.\\.\\." }
+ B<sizeof...(T)> f(); // { dg-message "sizeof\\.\\.\\." }
B<42> f(); // { dg-error "cannot be overloaded" }
};
===================================================================
@@ -77,7 +77,7 @@ namespace N2
{
struct U
{
- #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
};
}
@@ -109,9 +109,9 @@ namespace N4
struct U
{
#pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
- #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
- #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
+ #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
#pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (bar: short int: omp_out += omp_in)
@@ -132,7 +132,7 @@ namespace N5
template <typename T>
struct U
{
- #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: T: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
};
U<S> u;
@@ -159,9 +159,9 @@ namespace N6
{
typedef V V2;
#pragma omp declare reduction (bar: T: omp_out.t += omp_in.t)
- #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-error "with" }
+ #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (bar: V2: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" }
- #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" }
+ #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" }
#pragma omp declare reduction (bar: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (bar: short int: omp_out += omp_in)
===================================================================
@@ -2,6 +2,6 @@
struct S
{
- void f () {} // { dg-error "with" }
+ void f () {} // { dg-message "previous" }
int f () { return 0; } // { dg-error "overloaded" }
};
===================================================================
@@ -6,6 +6,6 @@
struct A
{
- void foo(); // { dg-error "with" }
+ void foo(); // { dg-message "previous" }
virtual void foo(); // { dg-error "cannot be overloaded" }
};
===================================================================
@@ -2,6 +2,6 @@
template<int> struct A
{
- ~A() {} // { dg-error "with" }
+ ~A() {} // { dg-message "previous" }
~A() {} // { dg-error "cannot be overloaded" }
};
===================================================================
@@ -31,7 +31,7 @@ class C
class D
{
public:
- int foo2() {return b;} // { dg-error "with" }
+ int foo2() {return b;} // { dg-message "previous" }
int foo2() {return b;} // { dg-error "overloaded" }
int b;
};
@@ -39,7 +39,7 @@ class D
class E
{
public:
- int foo2(); // { dg-error "with" }
+ int foo2(); // { dg-message "previous" }
int foo2(); // { dg-error "overloaded" }
int b;
};
===================================================================
@@ -8,12 +8,12 @@
class X {
public:
- int foo(); // { dg-error "with" }
+ int foo(); // { dg-message "previous" }
static int foo(); // error: redeclaration// { dg-error "overloaded" } .*
};
class Y {
public:
- static int foo(); // { dg-error "with" }
+ static int foo(); // { dg-message "previous" }
int foo(); // error: redeclaration// { dg-error "overloaded" } .*
};
===================================================================
@@ -1,9 +1,9 @@
// { dg-do assemble }
struct S {
- S(int); // { dg-error "with" }
+ S(int); // { dg-message "previous" }
S(int); // { dg-error "overloaded" } already declared
- ~S();// { dg-error "with" }
+ ~S();// { dg-message "previous" }
~S(); // { dg-error "overloaded" } already declared
};
===================================================================
@@ -1,7 +1,7 @@
// { dg-do assemble }
int main() {
struct A {
- void f(); // { dg-error "with" } already declared
+ void f(); // { dg-message "previous" } already declared
void f(); // { dg-error "overloaded" } already declared
};
}
===================================================================
@@ -23,7 +23,7 @@ template struct B<int>;
struct C
{
template <class U>
- void f() {} // { dg-error "with" } redeclaration
+ void f() {} // { dg-message "previous" } redeclaration
template <class U>
void f() {} // { dg-error "overloaded" } redeclaration
@@ -42,7 +42,7 @@ template struct D<int, double>;
template <class T, class U>
struct D2
{
- void f(T); // { dg-error "with" } redeclaration
+ void f(T); // { dg-message "previous" } redeclaration
void f(U); // { dg-error "overloaded" } redeclaration
};
@@ -50,7 +50,7 @@ template struct D2<int, int>;
struct E
{
- void f(); // { dg-error "with" } redeclaration
+ void f(); // { dg-message "previous" } redeclaration
void f(); // { dg-error "overloaded" } redeclaration
};