re PR c++/61945 (tree check fail with -Woverloaded-virtual)

PR c++/61945
	* class.c (warn_hidden): Check for FUNCTION_DECL.

	* g++.dg/warn/pr61945.C: New test.

From-SVN: r215597
This commit is contained in:
Marek Polacek 2014-09-25 12:56:57 +00:00 committed by Marek Polacek
parent c5b2614754
commit 6597738a3a
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-09-25 Marek Polacek <polacek@redhat.com>
PR c++/61945
* class.c (warn_hidden): Check for FUNCTION_DECL.
2014-09-25 Jakub Jelinek <jakub@redhat.com> 2014-09-25 Jakub Jelinek <jakub@redhat.com>
PR c++/63249 PR c++/63249

View File

@ -2821,7 +2821,8 @@ warn_hidden (tree t)
for (fn = fns; fn; fn = OVL_NEXT (fn)) for (fn = fns; fn; fn = OVL_NEXT (fn))
{ {
fndecl = OVL_CURRENT (fn); fndecl = OVL_CURRENT (fn);
if (DECL_VINDEX (fndecl)) if (TREE_CODE (fndecl) == FUNCTION_DECL
&& DECL_VINDEX (fndecl))
{ {
tree *prev = &base_fndecls; tree *prev = &base_fndecls;

View File

@ -1,3 +1,8 @@
2014-09-25 Marek Polacek <polacek@redhat.com>
PR c++/61945
* g++.dg/warn/pr61945.C: New test.
2014-09-25 Jakub Jelinek <jakub@redhat.com> 2014-09-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/63341 PR tree-optimization/63341

View File

@ -0,0 +1,11 @@
// PR c++/61945
// { dg-do compile }
// { dg-options "-Woverloaded-virtual" }
class A {
virtual int foo (); // { dg-warning "was hidden" }
};
class B : A {
template <typename>
void foo (); // { dg-warning "by .B::foo\\(\\)." }
};