From: Paolo Carlini Date: Thu, 29 Jun 2017 22:32:33 +0000 (+0000) Subject: class.c (add_method): Change pair of errors to error + inform. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e09cb8b390102c09039c3c31ab1c0df4114e3da;p=gcc.git class.c (add_method): Change pair of errors to error + inform. /cp 2017-06-29 Paolo Carlini * class.c (add_method): Change pair of errors to error + inform. (handle_using_decl): Likewise. /testsuite 2017-06-29 Paolo Carlini * g++.dg/cpp0x/inh-ctor3.C: Adjust for dg-message vs dg-error. * g++.dg/diagnostic/variadic1.C: Likewise. * g++.dg/gomp/udr-3.C: Likewise. * g++.dg/overload/error1.C: Likewise. * g++.dg/overload/error2.C: Likewise. * g++.dg/template/duplicate1.C: Likewise. * g++.old-deja/g++.benjamin/warn02.C: Likewise. * g++.old-deja/g++.brendan/arm2.C: Likewise. * g++.old-deja/g++.other/redecl2.C: Likewise. * g++.old-deja/g++.other/redecl4.C: Likewise. * g++.old-deja/g++.pt/memtemp78.C: Likewise. From-SVN: r249820 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2117eb6f5a1..40153aafea0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-06-29 Paolo Carlini + + * class.c (add_method): Change pair of errors to error + inform. + (handle_using_decl): Likewise. + 2017-06-29 Jason Merrill * constexpr.c, error.c, tree.c: Remove WITH_CLEANUP_EXPR handling. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c7ea3f4f500..09633b8dd9f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1217,10 +1217,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; @@ -1238,8 +1239,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; } } @@ -1371,16 +1374,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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fe42baf912..f3dad9ec6f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2017-06-29 Paolo Carlini + + * g++.dg/cpp0x/inh-ctor3.C: Adjust for dg-message vs dg-error. + * g++.dg/diagnostic/variadic1.C: Likewise. + * g++.dg/gomp/udr-3.C: Likewise. + * g++.dg/overload/error1.C: Likewise. + * g++.dg/overload/error2.C: Likewise. + * g++.dg/template/duplicate1.C: Likewise. + * g++.old-deja/g++.benjamin/warn02.C: Likewise. + * g++.old-deja/g++.brendan/arm2.C: Likewise. + * g++.old-deja/g++.other/redecl2.C: Likewise. + * g++.old-deja/g++.other/redecl4.C: Likewise. + * g++.old-deja/g++.pt/memtemp78.C: Likewise. + 2017-06-29 Cesar Philippidis PR fortran/77765 diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C index 8cbeed66047..c5a00750236 100644 --- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C @@ -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 { diff --git a/gcc/testsuite/g++.dg/diagnostic/variadic1.C b/gcc/testsuite/g++.dg/diagnostic/variadic1.C index 69f1f988f30..7e3db314328 100644 --- a/gcc/testsuite/g++.dg/diagnostic/variadic1.C +++ b/gcc/testsuite/g++.dg/diagnostic/variadic1.C @@ -4,6 +4,6 @@ template struct B { }; template struct A { - B f(); // { dg-error "sizeof\\.\\.\\." } + B f(); // { dg-message "sizeof\\.\\.\\." } B<42> f(); // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.dg/gomp/udr-3.C b/gcc/testsuite/g++.dg/gomp/udr-3.C index 9fc6f40820a..57531f2042b 100644 --- a/gcc/testsuite/g++.dg/gomp/udr-3.C +++ b/gcc/testsuite/g++.dg/gomp/udr-3.C @@ -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 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 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) diff --git a/gcc/testsuite/g++.dg/overload/error1.C b/gcc/testsuite/g++.dg/overload/error1.C index 6c5998c720a..a4fd4854eb2 100644 --- a/gcc/testsuite/g++.dg/overload/error1.C +++ b/gcc/testsuite/g++.dg/overload/error1.C @@ -2,6 +2,6 @@ struct S { - void f () {} // { dg-error "with" } + void f () {} // { dg-message "previous" } int f () { return 0; } // { dg-error "overloaded" } }; diff --git a/gcc/testsuite/g++.dg/overload/error2.C b/gcc/testsuite/g++.dg/overload/error2.C index 4a9d35bc49d..23a2ea18d3a 100644 --- a/gcc/testsuite/g++.dg/overload/error2.C +++ b/gcc/testsuite/g++.dg/overload/error2.C @@ -6,6 +6,6 @@ struct A { - void foo(); // { dg-error "with" } + void foo(); // { dg-message "previous" } virtual void foo(); // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.dg/template/duplicate1.C b/gcc/testsuite/g++.dg/template/duplicate1.C index c9cdab4b932..39185b350e7 100644 --- a/gcc/testsuite/g++.dg/template/duplicate1.C +++ b/gcc/testsuite/g++.dg/template/duplicate1.C @@ -2,6 +2,6 @@ template struct A { - ~A() {} // { dg-error "with" } + ~A() {} // { dg-message "previous" } ~A() {} // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C index a3d23747b48..b3b1387462d 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C @@ -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 @@ public: class E { public: - int foo2(); // { dg-error "with" } + int foo2(); // { dg-message "previous" } int foo2(); // { dg-error "overloaded" } int b; }; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C b/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C index fb1ee429d37..23d6ae69f79 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C @@ -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" } .* }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/redecl2.C b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C index 0d6ccf669f0..2da0b4f9978 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/redecl2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C @@ -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 }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/redecl4.C b/gcc/testsuite/g++.old-deja/g++.other/redecl4.C index e3355dafc41..c2303575dfc 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/redecl4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/redecl4.C @@ -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 }; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C index 73348351f0d..a8ba371af7a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C @@ -23,7 +23,7 @@ template struct B; struct C { template - void f() {} // { dg-error "with" } redeclaration + void f() {} // { dg-message "previous" } redeclaration template void f() {} // { dg-error "overloaded" } redeclaration @@ -42,7 +42,7 @@ template struct D; template 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; struct E { - void f(); // { dg-error "with" } redeclaration + void f(); // { dg-message "previous" } redeclaration void f(); // { dg-error "overloaded" } redeclaration };