From: Marek Polacek Date: Thu, 25 Sep 2014 12:56:57 +0000 (+0000) Subject: re PR c++/61945 (tree check fail with -Woverloaded-virtual) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6597738a3a5bb21cab76d013a3c6c3c0bb0b3d34;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2457ccdb734..a11a52009b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-09-25 Marek Polacek + + PR c++/61945 + * class.c (warn_hidden): Check for FUNCTION_DECL. + 2014-09-25 Jakub Jelinek PR c++/63249 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c4ac61bd0a0..acf5768b7d3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2821,7 +2821,8 @@ warn_hidden (tree t) for (fn = fns; fn; fn = OVL_NEXT (fn)) { fndecl = OVL_CURRENT (fn); - if (DECL_VINDEX (fndecl)) + if (TREE_CODE (fndecl) == FUNCTION_DECL + && DECL_VINDEX (fndecl)) { tree *prev = &base_fndecls; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f1806f64503..953a5b2a3e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-25 Marek Polacek + + PR c++/61945 + * g++.dg/warn/pr61945.C: New test. + 2014-09-25 Jakub Jelinek PR tree-optimization/63341 diff --git a/gcc/testsuite/g++.dg/warn/pr61945.C b/gcc/testsuite/g++.dg/warn/pr61945.C new file mode 100644 index 00000000000..5584d841692 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr61945.C @@ -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 + void foo (); // { dg-warning "by .B::foo\\(\\)." } +};