Commit 7cf66a2d by Marek Polacek Committed by Marek Polacek

PR c++/91921 - stray warning with -Woverloaded-virtual.

	* class.c (warn_hidden): Only emit the second part of
	-Woverloaded-virtual if the first part was issued.  Use inform instead
	warning_at.

	* g++.dg/warn/Woverloaded-2.C: New.
	* g++.dg/warn/Woverloaded-2.h: New.
	* g++.dg/warn/pr61945.C: Turn dg-warning into dg-message.
	* g++.old-deja/g++.mike/warn6.C: Likewise.
	* g++.old-deja/g++.warn/virt1.C: Likewise.

From-SVN: r276249
parent 028c9b3b
2019-09-28 Marek Polacek <polacek@redhat.com> 2019-09-28 Marek Polacek <polacek@redhat.com>
PR c++/91921 - stray warning with -Woverloaded-virtual.
* class.c (warn_hidden): Only emit the second part of
-Woverloaded-virtual if the first part was issued. Use inform instead
warning_at.
PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17. PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
* pt.c (invalid_nontype_parm_type_p): Only emit errors when * pt.c (invalid_nontype_parm_type_p): Only emit errors when
tf_error. tf_error.
......
...@@ -2914,12 +2914,12 @@ warn_hidden (tree t) ...@@ -2914,12 +2914,12 @@ warn_hidden (tree t)
FOR_EACH_VEC_ELT (base_fndecls, j, base_fndecl) FOR_EACH_VEC_ELT (base_fndecls, j, base_fndecl)
if (base_fndecl) if (base_fndecl)
{ {
auto_diagnostic_group d;
/* Here we know it is a hider, and no overrider exists. */ /* Here we know it is a hider, and no overrider exists. */
warning_at (location_of (base_fndecl), if (warning_at (location_of (base_fndecl),
OPT_Woverloaded_virtual, OPT_Woverloaded_virtual,
"%qD was hidden", base_fndecl); "%qD was hidden", base_fndecl))
warning_at (location_of (fns), inform (location_of (fns), " by %qD", fns);
OPT_Woverloaded_virtual, " by %qD", fns);
} }
} }
} }
......
2019-09-28 Marek Polacek <polacek@redhat.com> 2019-09-28 Marek Polacek <polacek@redhat.com>
PR c++/91921 - stray warning with -Woverloaded-virtual.
* g++.dg/warn/Woverloaded-2.C: New.
* g++.dg/warn/Woverloaded-2.h: New.
* g++.dg/warn/pr61945.C: Turn dg-warning into dg-message.
* g++.old-deja/g++.mike/warn6.C: Likewise.
* g++.old-deja/g++.warn/virt1.C: Likewise.
PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17. PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
* g++.dg/cpp0x/nontype5.C: New test. * g++.dg/cpp0x/nontype5.C: New test.
......
// PR c++/91921 - stray warning with -Woverloaded-virtual.
// { dg-options "-Woverloaded-virtual" }
#include "Woverloaded-2.h"
struct B : A
{
void f(int);
};
#pragma GCC system_header
struct A
{
virtual void f();
};
...@@ -7,5 +7,5 @@ class A { ...@@ -7,5 +7,5 @@ class A {
}; };
class B : A { class B : A {
template <typename> template <typename>
void foo (); // { dg-warning "by .B::foo\\(\\)." } void foo (); // { dg-message "by .B::foo\\(\\)." }
}; };
...@@ -30,13 +30,13 @@ struct D : public B, public B2, public B3 { ...@@ -30,13 +30,13 @@ struct D : public B, public B2, public B3 {
virtual void bothsame(int); virtual void bothsame(int);
virtual void bothdiff(int); // { dg-warning "" } virtual void bothdiff(int); // { dg-message "" }
virtual void both2same(int); virtual void both2same(int);
virtual void both2same(float); virtual void both2same(float);
virtual void both12diff(int); // { dg-warning "" } virtual void both12diff(int); // { dg-message "" }
virtual void bothfardiff(int); // { dg-warning "" } virtual void bothfardiff(int); // { dg-message "" }
}; };
...@@ -6,5 +6,5 @@ struct A { ...@@ -6,5 +6,5 @@ struct A {
}; };
struct B: public A { struct B: public A {
void f(int); // { dg-warning "" } by this void f(int); // { dg-message "" } by this
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment