re PR c++/28501 (ICE with __real__ and implicit type conversion)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 3 May 2011 18:30:37 +0000 (18:30 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 3 May 2011 18:30:37 +0000 (18:30 +0000)
/cp
2011-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/28501
* call.c (add_builtin_candidate): Handle REALPART_EXPR and
IMAGPART_EXPR.

/testsuite
2011-05-03  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/28501
* g++.dg/ext/complex9.C: New.

From-SVN: r173337

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/complex9.C [new file with mode: 0644]

index e44ff10d9fbd5c638a3f28b2ae5e5e7b1a991090..dccd765122254fc319e9bb345ad5e784096578fa 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-03  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/28501
+       * call.c (add_builtin_candidate): Handle REALPART_EXPR and
+       IMAGPART_EXPR.
+
 2011-05-02  Lawrence Crowl  <crowl@google.com>
 
        * decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop.
index 4dbcce922ee5b26ddf2e6f96d4a9d36e23a63f74..f5bd521ddaa564631fd2a99b7678ae39ba972e5a 100644 (file)
@@ -1,6 +1,7 @@
 /* Functions related to invoking methods and overloaded functions.
    Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+   2010, 2011
    Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) and
    modified by Brendan Kehoe (brendan@cygnus.com).
@@ -2586,6 +2587,12 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
         types are TYPE2.  */
       break;
 
+    case REALPART_EXPR:
+    case IMAGPART_EXPR:
+      if (ARITHMETIC_TYPE_P (type1))
+       break;
+      return;
     default:
       gcc_unreachable ();
     }
index a796f4fc2190efd2c7226a5d12d83e72f299217d..332b2092bbd7f37ec2bd2da05ebab8c844298ea1 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-03  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/28501
+       * g++.dg/ext/complex9.C: New.
+
 2011-05-03  Stuart Henderson  <shenders@gcc.gnu.org>
 
        From Mike Frysinger
diff --git a/gcc/testsuite/g++.dg/ext/complex9.C b/gcc/testsuite/g++.dg/ext/complex9.C
new file mode 100644 (file)
index 0000000..5bb1625
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/28501
+
+struct A
+{
+  operator int();
+};
+
+int i = __real__ A();