From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15385 invoked by alias); 31 Oct 2011 15:56:55 -0000 Received: (qmail 15377 invoked by uid 22791); 31 Oct 2011 15:56:53 -0000 X-SWARE-Spam-Status: No, hits=-7.1 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; Mon, 31 Oct 2011 15:56:39 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9VFucX0027627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 Oct 2011 11:56:38 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9VFucZ8017846; Mon, 31 Oct 2011 11:56:38 -0400 Received: from [0.0.0.0] (ovpn-113-26.phx2.redhat.com [10.3.113.26]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p9VFuaNe009010; Mon, 31 Oct 2011 11:56:37 -0400 Message-ID: <4EAEC534.5070105@redhat.com> Date: Mon, 31 Oct 2011 17:52: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: 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> <4EA9B55B.6000406@redhat.com> <4EAD85D3.9010101@verizon.net> In-Reply-To: <4EAD85D3.9010101@verizon.net> Content-Type: text/plain; charset=ISO-8859-1; 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/msg02859.txt.bz2 On 10/30/2011 01:13 PM, Ed Smith-Rowland wrote: > + /* Look for a literal operator taking the exact type of numeric argument > + as the literal value. */ Is this right? Do numeric literals only get here with type unsigned long long or long double? > + while (fns) > { > tree tmpl_args = make_char_string_pack (num_string); > - decl = lookup_template_function (decl, tmpl_args); > - result = finish_call_expr (decl, &args, false, true, tf_none); > - if (result != error_mark_node) > + tree fn = OVL_CURRENT (fns); > + tree argtypes = NULL_TREE; > + if (TREE_CODE (TREE_TYPE (fn)) != LANG_TYPE) > + argtypes = TYPE_ARG_TYPES (TREE_TYPE (fn)); > + if (argtypes != NULL_TREE > + && same_type_p (TREE_VALUE (argtypes), void_type_node)) Let's wait to make the pack until we find a template. Also, you should be able to just check for TEMPLATE_DECL since we won't accept a literal operator template with different parameter types. For string and character literals, we can still just build up a call; we only need to walk the overload list here for numeric literals. Jason