From patchwork Tue May 3 18:31:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 93876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A89B7B6F14 for ; Wed, 4 May 2011 04:32:38 +1000 (EST) Received: (qmail 1830 invoked by alias); 3 May 2011 18:32:36 -0000 Received: (qmail 1818 invoked by uid 22791); 3 May 2011 18:32:35 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp204.alice.it (HELO smtp204.alice.it) (82.57.200.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 18:32:20 +0000 Received: from [192.168.1.4] (79.53.21.62) by smtp204.alice.it (8.5.124.08) id 4D7E0F6404500C02 for gcc-patches@gcc.gnu.org; Tue, 3 May 2011 20:32:17 +0200 Message-ID: <4DC04A0B.70702@oracle.com> Date: Tue, 03 May 2011 20:31:39 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Subject: [C++ Patch, committed] PR 28501 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, tested x86_64-linux, approved by Jason on the audit trail, committed to mainline. Thanks! Paolo. /////////////////////// /cp 2011-05-03 Paolo Carlini PR c++/28501 * call.c (add_builtin_candidate): Handle REALPART_EXPR and IMAGPART_EXPR. /testsuite 2011-05-03 Paolo Carlini PR c++/28501 * g++.dg/ext/complex9.C: New. 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 (); }