From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17784 invoked by alias); 27 Oct 2011 19:47:57 -0000 Received: (qmail 17776 invoked by uid 22791); 27 Oct 2011 19:47:56 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 19:47:42 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9RJlfL6028038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Oct 2011 15:47:41 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9RJlfhD003317; Thu, 27 Oct 2011 15:47:41 -0400 Received: from [0.0.0.0] ([10.3.113.11]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p9RJldF6030290; Thu, 27 Oct 2011 15:47:40 -0400 Message-ID: <4EA9B55B.6000406@redhat.com> Date: Thu, 27 Oct 2011 20:37:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: Ed Smith-Rowland <3dw4rd@verizon.net> CC: Tom Tromey , gcc-patches@gcc.gnu.org Subject: Re: [C++-11] User defined literals References: <1632385954.7660675.1318453113423.JavaMail.root@vznit170070> <4E99F042.3020709@redhat.com> <4EA18271.6060705@verizon.net> <4EA1E218.6060404@redhat.com> <4EA57BEA.1070600@verizon.net> <4EA732DE.50701@redhat.com> <4EA7A1ED.6030206@verizon.net> <4EA861C1.8080703@redhat.com> <4EA9B1D7.3060304@verizon.net> In-Reply-To: <4EA9B1D7.3060304@verizon.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02509.txt.bz2 On 10/27/2011 03:32 PM, Ed Smith-Rowland wrote: > + if (TREE_CODE (TREE_TYPE (decl)) != LANG_TYPE) > + argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl)); If you have multiple overloaded operator"" _foo, you need to iterate over them looking for the one (or ones, in the case of numeric literals) you want. > + if (argtypes != NULL_TREE > + && TREE_VALUE (argtypes) != TREE_TYPE (value)) I think you want if (argtypes == NULL_TREE || !same_type_p (TREE_VALUE (argtypes), TREE_TYPE (value))) > + if (TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE) > + { > + if (argtypes != NULL_TREE > + && TREE_CODE (TREE_VALUE (argtypes)) == REAL_TYPE) > + { > + error ("unable to find %qD with % argument", > + name); > + return error_mark_node; > + } > + } > + else if (TREE_CODE (TREE_TYPE (value)) == REAL_TYPE) > + { > + if (argtypes != NULL_TREE > + && TREE_CODE (TREE_VALUE (argtypes)) == INTEGER_TYPE) > + { > + error ("unable to find %qD with % argument", name); > + return error_mark_node; > + } > + } This looks like it will break raw operators. Jason