diff mbox

[C++,committed] PR 28501

Message ID 4DC04A0B.70702@oracle.com
State New
Headers show

Commit Message

Paolo Carlini May 3, 2011, 6:31 p.m. UTC
Hi,

tested x86_64-linux, approved by Jason on the audit trail, committed to 
mainline.

Thanks!
Paolo.

///////////////////////
/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.
diff mbox

Patch

Index: testsuite/g++.dg/ext/complex9.C
===================================================================
--- testsuite/g++.dg/ext/complex9.C	(revision 0)
+++ testsuite/g++.dg/ext/complex9.C	(revision 0)
@@ -0,0 +1,8 @@ 
+// PR c++/28501
+
+struct A
+{
+  operator int();
+};
+
+int i = __real__ A();
Index: cp/call.c
===================================================================
--- cp/call.c	(revision 173336)
+++ cp/call.c	(working copy)
@@ -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 **candid
 	 types are TYPE2.  */
       break;
 
+    case REALPART_EXPR:
+    case IMAGPART_EXPR:
+      if (ARITHMETIC_TYPE_P (type1))
+	break;
+      return;
+ 
     default:
       gcc_unreachable ();
     }