]> 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:49:17 +0000 (14:49 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 11 May 2006 14:49:17 +0000 (14:49 +0000)
PR c++/27547
* decl.c (copy_fn_p): Return early on non-member functions.

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

From-SVN: r113698

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

index cc1cbddd15b64db683765272917873800c73c06d..26fa4eea0ed515760e6e4b6300f21b077123758f 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>
 
        * decl.c (grok_op_properties): Add missing return value.
index 7828dfee05369ddf9351e2d0fc8676207854ae9c..6bb0911824b3c3c9ddc3dfa5904b77c777b4067a 100644 (file)
@@ -8476,7 +8476,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 (DECL_TEMPLATE_INFO (d) 
       && DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (d)))
index 97da8e57a6361ee7832f283b036d510bb148b9be..a15879b6a17d55c57edf1f39584d09d9f02d8f73 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-09  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/27136
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..2769d25
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/27547
+// { dg-do compile }
+
+int operator=(int);  // { dg-error "member function|two arguments" }
+
+void foo()
+{
+  operator=(0);
+}