+2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
+
+ * search.c (check_final_overrider): Use inform instead of error
+ for the diagnostics of the overridden functions. Tweak wording.
+
2018-03-27 Jakub Jelinek <jakub@redhat.com>
PR c++/85068
if (pedwarn (DECL_SOURCE_LOCATION (overrider), 0,
"invalid covariant return type for %q#D", overrider))
inform (DECL_SOURCE_LOCATION (basefn),
- " overriding %q#D", basefn);
+ "overridden function is %q#D", basefn);
}
else
fail = 2;
if (fail == 1)
{
error ("invalid covariant return type for %q+#D", overrider);
- error (" overriding %q+#D", basefn);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %q#D", basefn);
}
else
{
error ("conflicting return type specified for %q+#D", overrider);
- error (" overriding %q+#D", basefn);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %q#D", basefn);
}
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
if (!comp_except_specs (base_throw, over_throw, ce_derived))
{
error ("looser throw specifier for %q+#F", overrider);
- error (" overriding %q+#F", basefn);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %q#F", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
&& !tx_safe_fn_type_p (over_type))
{
error ("conflicting type attributes specified for %q+#D", overrider);
- error (" overriding %q+#D", basefn);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %q#D", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
{
if (DECL_DELETED_FN (overrider))
{
- error ("deleted function %q+D", overrider);
- error ("overriding non-deleted function %q+D", basefn);
+ error ("deleted function %q+D overriding non-deleted function",
+ overrider);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %qD", basefn);
maybe_explain_implicit_delete (overrider);
}
else
{
- error ("non-deleted function %q+D", overrider);
- error ("overriding deleted function %q+D", basefn);
+ error ("non-deleted function %q+D overriding deleted function",
+ overrider);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %qD", basefn);
}
return 0;
}
if (DECL_FINAL_P (basefn))
{
- error ("virtual function %q+D", overrider);
- error ("overriding final function %q+D", basefn);
+ error ("virtual function %q+D overriding final function", overrider);
+ inform (DECL_SOURCE_LOCATION (basefn),
+ "overridden function is %qD", basefn);
return 0;
}
return 1;
+2018-03-27 Volker Reichelt <v.reichelt@netcologne.de>
+
+ * g++.dg/cpp0x/defaulted2.C: Use dg-message instead of dg-error
+ for the diagnostics of overridden functions. Adjust for new wording.
+ * g++.dg/cpp0x/implicit1.C: Likewise.
+ * g++.dg/cpp0x/override1.C: Likewise.
+ * g++.dg/cpp1y/auto-fn18.C: Likewise.
+ * g++.dg/eh/shadow1.C: Likewise.
+ * g++.dg/inherit/covariant12.C: Likewise.
+ * g++.dg/inherit/covariant14.C: Likewise.
+ * g++.dg/inherit/covariant15.C: Likewise.
+ * g++.dg/inherit/covariant16.C: Likewise.
+ * g++.dg/inherit/covariant22.C: Likewise.
+ * g++.dg/inherit/crash3.C: Likewise.
+ * g++.dg/inherit/error2.C: Likewise.
+ * g++.dg/template/crash100.C: Likewise.
+ * g++.old-deja/g++.eh/spec6.C: Likewise.
+ * g++.old-deja/g++.mike/p811.C: Likewise.
+ * g++.old-deja/g++.other/virtual11.C: Likewise.
+ * g++.old-deja/g++.other/virtual4.C: Likewise.
+
2018-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/85044
struct C
{
- virtual void f() = delete; // { dg-error "overriding deleted" }
+ virtual void f() = delete; // { dg-message "overridden" }
};
struct D: public C
{
void operator delete (void *); // { dg-message "private" }
public:
- virtual ~C(); // { dg-error "overriding" }
+ virtual ~C(); // { dg-message "overridden" }
};
struct D: C { }; // { dg-error "deleted" }
struct F
{
- virtual ~F(); // { dg-error "overriding" }
+ virtual ~F(); // { dg-message "overridden" }
};
struct G: E, F { }; // { dg-error "deleted" }
virtual void y() final;
};
-void B::y() {} // { dg-error "overriding" }
+void B::y() {} // { dg-message "overridden" }
struct B2
{
struct D : B
{
- virtual void g() override final {} // { dg-error "overriding" }
+ virtual void g() override final {} // { dg-message "overridden" }
virtual void y() override final {} // { dg-error "virtual" }
};
struct A
{
- virtual int f() { return 1; } // { dg-message "overriding" }
+ virtual int f() { return 1; } // { dg-message "overridden" }
virtual auto g() { return 1; } // { dg-error "virtual" }
};
friend class E;
static B *baz (D *);
- virtual void V () throw (B); // { dg-error "overriding" "" { target { ! c++17 } } }
+ virtual void V () throw (B); // { dg-message "overridden" "" { target { ! c++17 } } }
}; // { dg-error "dynamic exception specification" "" { target c++17 } .-1 }
// { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } .-2 }
struct E : public D
struct B
{
- virtual T *Foo (); // { dg-error "overriding" }
+ virtual T *Foo (); // { dg-message "overridden" }
};
struct D : B
struct B
{
- virtual A* foo(); // { dg-error "overriding" }
+ virtual A* foo(); // { dg-message "overridden" }
};
namespace N
class B : A
{
- virtual A* foo(); /* { dg-error "overriding" } */
+ virtual A* foo(); /* { dg-message "overridden" } */
};
struct C : virtual B
struct B : virtual A
{
- virtual B* foo(); /* { dg-error "overriding" } */
+ virtual B* foo(); /* { dg-message "overridden" } */
};
struct C : B
struct B
{
- virtual A *foo (); // { dg-error "overriding" }
+ virtual A *foo (); // { dg-message "overridden" }
};
struct C : virtual B
struct A
{
- virtual int& foo(); // { dg-error "overriding" }
+ virtual int& foo(); // { dg-message "overridden" }
};
struct B : A
struct A
{
- virtual A* foo(); // { dg-error "overriding" }
+ virtual A* foo(); // { dg-message "overridden" }
};
struct B : virtual A; // { dg-error "before" }
public:
operator T&(void) { return Val; }
- virtual T& operator=(T a ) // { dg-error "overriding" }
+ virtual T& operator=(T a ) // { dg-message "overridden" }
{
Val = a;
return Val;
struct H : private E {};
struct A
{
- virtual void foo() throw(); // { dg-error "" } overriding
+ virtual void foo() throw(); // { dg-message "" } overridden
virtual void baz() throw(double, int);
virtual void bar();
virtual void qux() throw(E);
- virtual void qux(int) throw(E const *); // { dg-error "" } overriding (pedantically)
- virtual void quux() throw(F); // { dg-error "" } overriding
- virtual void quux(int) throw(F *); // { dg-error "" } overriding
- virtual void wibble() throw(E); // { dg-error "" } overriding
- virtual void wobble() throw(E *); // { dg-error "" } overriding
- virtual void wobble(int) throw(E *); // { dg-error "" } overriding
+ virtual void qux(int) throw(E const *); // { dg-message "" } overridden (pedantically)
+ virtual void quux() throw(F); // { dg-message "" } overridden
+ virtual void quux(int) throw(F *); // { dg-message "" } overridden
+ virtual void wibble() throw(E); // { dg-message "" } overridden
+ virtual void wobble() throw(E *); // { dg-message "" } overridden
+ virtual void wobble(int) throw(E *); // { dg-message "" } overridden
virtual void wabble(int) throw(E *);
virtual void wubble(int) throw(E *, H *);
- virtual ~A() throw(); // { dg-error "" } overriding
+ virtual ~A() throw(); // { dg-message "" } overriding
};
struct B : A
struct A1
{
virtual void foo() throw(int);
- virtual void bar() throw(); // { dg-error "" } overriding
+ virtual void bar() throw(); // { dg-message "" } overridden
virtual ~A1() throw(int);
};
public:
Y() {}
virtual const char *stringify() = 0;
- virtual char *stringify2() const = 0; // { dg-error "overriding" }
+ virtual char *stringify2() const = 0; // { dg-message "overridden" }
};
class X: public Y { // { dg-message "defined here" }
struct B
{
- virtual void foo (); // { dg-error "" } of this function
+ virtual void foo (); // { dg-message "" } of this function
};
struct C : A , B
class A {
public:
- virtual int foo() = 0; // { dg-error "" } original definition
+ virtual int foo() = 0; // { dg-message "" } original definition
};
class B {