]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/27547 (ICE on invalid operator=)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Thu, 11 May 2006 14:41:03 +0000 (14:41 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 11 May 2006 14:41:03 +0000 (14:41 +0000)
PR c++/27547
* decl.c (copy_fn_p): Return early on non-member functions.

* g++.dg/other/operator1.C: New test.

From-SVN: r113696

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

index a357204e4a62cf1a46f2bc549ebff912ad18d951..898c13fef06a7fea331be6c47abca4494b4936f9 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-11  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27547
+       * decl.c (copy_fn_p): Return early on non-member functions.
+
 2006-05-08  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/27447
index 057c1fb51691f43e4abeb3aaa1392e41e6fa7c3d..1b5e41d373c7c56098fd04b4bc58e44d575cef86 100644 (file)
@@ -8818,7 +8818,9 @@ copy_fn_p (tree d)
   tree arg_type;
   int result = 1;
 
-  gcc_assert (DECL_FUNCTION_MEMBER_P (d));
+  if (!DECL_FUNCTION_MEMBER_P (d))
+    /* Non-members are invalid.  We complained, but kept the declaration.  */
+    return 0;
 
   if (TREE_CODE (d) == TEMPLATE_DECL
       || (DECL_TEMPLATE_INFO (d)
index 418c6718b0339cf9612feeba54308557a906b3ea..036f0dfc6e3d73739d2a9e20616b6bc257d979cf 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-11  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27547
+       * g++.dg/other/operator1.C: New test.
+
 2006-05-11  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/27529
diff --git a/gcc/testsuite/g++.dg/other/operator1.C b/gcc/testsuite/g++.dg/other/operator1.C
new file mode 100644 (file)
index 0000000..1760a1c
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/27547
+// { dg-do compile }
+
+int operator=(int);  // { dg-error "member function" }
+
+void foo()
+{
+  operator=(0);
+}