From patchwork Wed Dec 7 01:38:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Smith-Rowland <3dw4rd@verizon.net> X-Patchwork-Id: 129880 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 E36371007D6 for ; Wed, 7 Dec 2011 12:39:22 +1100 (EST) Received: (qmail 5427 invoked by alias); 7 Dec 2011 01:39:19 -0000 Received: (qmail 5417 invoked by uid 22791); 7 Dec 2011 01:39:18 -0000 X-SWARE-Spam-Status: No, hits=3.9 required=5.0 tests=AWL, BAYES_05, BOTNET, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, TW_FN X-Spam-Check-By: sourceware.org Received: from vms173013pub.verizon.net (HELO vms173013pub.verizon.net) (206.46.173.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Dec 2011 01:39:04 +0000 Received: from [192.168.1.8] ([unknown] [108.15.31.125]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LVT006HP8KGUDR0@vms173013.mailsrvcs.net> for gcc-patches@gcc.gnu.org; Tue, 06 Dec 2011 19:38:41 -0600 (CST) Message-id: <4EDEC3A0.90104@verizon.net> Date: Tue, 06 Dec 2011 20:38:40 -0500 From: Ed Smith-Rowland <3dw4rd@verizon.net> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-version: 1.0 To: Jason Merrill Cc: gcc-patches Subject: Re: [C++ PATCH] ICE with invalid user-defined literals (PR c++/51420) References: <4EDE16DB.1070804@verizon.net> <4EDE6CB5.7070001@redhat.com> In-reply-to: <4EDE6CB5.7070001@redhat.com> Content-type: multipart/mixed; boundary=------------040501090403070803010502 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 On 12/06/2011 02:27 PM, Jason Merrill wrote: > On 12/06/2011 08:21 AM, Ed Smith-Rowland wrote: >> * parser.c (lookup_literal_operator): Check that current overload >> is function_type. > > Instead of checking here, let's check is_overloaded_fn (decl) right > after the lookup name. > > Jason > OK, This passes all tests including the new test case. gcc/testsuite: 2011-12-06 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/51420 * g++.dg/cpp0x/pr51420.C: New. gcc/cp: 2011-12-06 Ed Smith-Rowland <3dw4rd@verizon.net> PR c++/51420 * parser.c (lookup_literal_operator): Check that declaration is an overloaded function. Index: gcc/testsuite/g++.dg/cpp0x/pr51420.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/pr51420.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/pr51420.C (revision 0) @@ -0,0 +1,8 @@ +// { dg-options "-std=c++11" } + +void +foo() +{ + float x = operator"" _F(); // { dg-error "was not declared in this scope" } + float y = 0_F; // { dg-error "unable to find numeric literal operator" } +} Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 182068) +++ gcc/cp/parser.c (working copy) @@ -3554,7 +3554,7 @@ { tree decl, fns; decl = lookup_name (name); - if (!decl || decl == error_mark_node) + if (!decl || !is_overloaded_fn (decl)) return error_mark_node; for (fns = decl; fns; fns = OVL_NEXT (fns))