From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11993 invoked by alias); 13 Oct 2011 09:39:29 -0000 Received: (qmail 11980 invoked by uid 22791); 13 Oct 2011 09:39:27 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Oct 2011 09:39:13 +0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/38174] Missing some built-in candidates for operator overloading Date: Thu, 13 Oct 2011 09:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01220.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38174 --- Comment #5 from Paolo Carlini 2011-10-13 09:38:57 UTC --- Thanks Jason, I thought we had to purely *add* overloads. Therefore we'll have to refactor the code a bit I guess, to always have a single call at the end of add_builtin_candidate. For the record, yesterday was playing with things like the below. I hope the additional code eventually will not be *much* more complex, maybe I will be able to help... ////////////// Index: call.c =================================================================== --- call.c (revision 179867) +++ call.c (working copy) @@ -2582,6 +2582,28 @@ || MAYBE_CLASS_TYPE_P (type1) || TREE_CODE (type1) == ENUMERAL_TYPE)) { + tree type1_type = TREE_TYPE (type1); + tree type2_type = TREE_TYPE (type2); + + if (TYPE_PTR_P (type1) && TYPE_PTR_P (type2) + && same_type_p (TYPE_MAIN_VARIANT (type1_type), + TYPE_MAIN_VARIANT (type2_type))) + { + if ((CP_TYPE_CONST_P (type1_type) + && CP_TYPE_VOLATILE_P (type2_type)) + || (CP_TYPE_VOLATILE_P (type1_type) + && CP_TYPE_CONST_P (type2_type))) + { + tree ctype + = build_pointer_type + (cp_build_qualified_type (TYPE_MAIN_VARIANT (type1_type), + (TYPE_QUAL_CONST + | TYPE_QUAL_VOLATILE))); + build_builtin_candidate + (candidates, fnname, ctype, ctype, args, argtypes, flags); + } + } + build_builtin_candidate (candidates, fnname, type1, type1, args, argtypes, flags); build_builtin_candidate