]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/45473 (ICE: in dfs_walk_once, at cp/search.c:1659)
authorJason Merrill <jason@redhat.com>
Sat, 6 Nov 2010 01:44:31 +0000 (21:44 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 6 Nov 2010 01:44:31 +0000 (21:44 -0400)
PR c++/45473
* search.c (look_for_overrides): A constructor is never virtual.

From-SVN: r166391

gcc/cp/ChangeLog
gcc/cp/search.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/inherit/virtual6.C [new file with mode: 0644]

index 939b05af362b00297cbb3bbfeeb36f01066bf72f..cab1040c6ddcfdc10ebc4074ddc94efbc285ef1f 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/45473
+       * search.c (look_for_overrides): A constructor is never virtual.
+
 2010-11-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/46160
index 0249fb06d4801310215dd61ff82021d9687626a5..370ddf636c33a31b2de59843f81ad373a6df41b2 100644 (file)
@@ -1935,6 +1935,11 @@ look_for_overrides (tree type, tree fndecl)
   int ix;
   int found = 0;
 
+  /* A constructor for a class T does not override a function T
+     in a base class.  */
+  if (DECL_CONSTRUCTOR_P (fndecl))
+    return 0;
+
   for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
     {
       tree basetype = BINFO_TYPE (base_binfo);
index 0cc58bf84af2f4202a567316f1fd129f1b41a65a..dbde8313206cb0ebf6a8bf1d0b1bafebf10a3edc 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/45473
+       * g++.dg/inherit/virtual6.C: New.
+
 2010-11-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/44772
diff --git a/gcc/testsuite/g++.dg/inherit/virtual6.C b/gcc/testsuite/g++.dg/inherit/virtual6.C
new file mode 100644 (file)
index 0000000..f036969
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/45473
+
+struct A
+{
+  virtual void B ();
+};
+
+struct B : A
+{
+  B ();
+};
+
+struct C : B
+{
+};
This page took 0.086766 seconds and 5 git commands to generate.