re PR c++/28258 (ICE with invalid constructor)
authorLee Millward <lee.millward@gmail.com>
Tue, 18 Jul 2006 17:22:39 +0000 (17:22 +0000)
committerLee Millward <lmillward@gcc.gnu.org>
Tue, 18 Jul 2006 17:22:39 +0000 (17:22 +0000)
PR c++/28258
* method.c (locate_copy): Check for non_reference
returning error_mark_node.

        PR c++/28260
* decl.c (duplicate_decls): Return error_mark_node
on ambiguous declaration.

PR c++/28258
* g++/dg/other/error13.C: New test.

PR c++/28260
* g++.dg/template/friend44.C: New test.

From-SVN: r115561

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/error13.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/friend44.C [new file with mode: 0644]

index 6f0b96b5b4c8e2ad3960c30112b67915a8eaf71a..cf7a062bd615c142ac5f58875f755d07d0f4dc89 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-18  Lee Millward  <lee.millward@gmail.com>
+
+       PR c++/28258
+       * method.c (locate_copy): Check for non_reference
+       returning error_mark_node.
+
+        PR c++/28260
+       * decl.c (duplicate_decls): Return error_mark_node
+       on ambiguous declaration.
+       
 2006-07-18  Steve Ellcey  <sje@cup.hp.com>
 
        PR c++/27495
index dd0e7e3e892e9e23f74e9d4ac20f0c5a444895bd..6165a2fb4fe8fb4285e6f9a96872a90d6c5f3daf 100644 (file)
@@ -1371,6 +1371,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
            {
              error ("new declaration %q#D", newdecl);
              error ("ambiguates old declaration %q+#D", olddecl);
+              return error_mark_node;
            }
          else
            return NULL_TREE;
index 9029e85a653ac31de32977dac44473324209714d..312e3a9c04a174860ce90dba59a3f83491ddfbf0 100644 (file)
@@ -946,6 +946,10 @@ locate_copy (tree type, void *client_)
       if (!parms)
        continue;
       src_type = non_reference (TREE_VALUE (parms));
+
+      if (src_type == error_mark_node)
+        return NULL_TREE;
+
       if (!same_type_ignoring_top_level_qualifiers_p (src_type, type))
        continue;
       if (!sufficient_parms_p (TREE_CHAIN (parms)))
index 4df2b2f720113876f58f818320e78c1f043dd65e..2025aadbacc2cf1cadcddc75d005fe2f96b92119 100644 (file)
@@ -1,3 +1,11 @@
+2006-07-18  Lee Millward  <lee.millward@gmail.com>
+
+       PR c++/28258
+       * g++/dg/other/error13.C: New test.
+
+       PR c++/28260
+       * g++.dg/template/friend44.C: New test.
+       
 2006-07-18  Steve Ellcey  <sje@cup.hp.com>
 
        PR c++/27495
diff --git a/gcc/testsuite/g++.dg/other/error13.C b/gcc/testsuite/g++.dg/other/error13.C
new file mode 100644 (file)
index 0000000..037e288
--- /dev/null
@@ -0,0 +1,10 @@
+//PR c++/28258
+
+struct A 
+{            // { dg-error "" }
+  A(void x); // { dg-error "invalid use|incomplete type|candidates" }
+};
+
+struct B : A {}; // { dg-error "no matching function for call" }
+B b; // { dg-error "synthesized method" }
diff --git a/gcc/testsuite/g++.dg/template/friend44.C b/gcc/testsuite/g++.dg/template/friend44.C
new file mode 100644 (file)
index 0000000..a0f63c8
--- /dev/null
@@ -0,0 +1,8 @@
+//PR c++/28260
+
+template<int> struct A
+{
+  friend int foo(); // { dg-error "new declaration" }
+};
+
+void foo() { A<0> a; } // { dg-error "ambiguates old declaration" }