From patchwork Tue Dec 6 13:21:31 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: 129681 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 C58401007D5 for ; Wed, 7 Dec 2011 00:22:27 +1100 (EST) Received: (qmail 32344 invoked by alias); 6 Dec 2011 13:22:18 -0000 Received: (qmail 32336 invoked by uid 22791); 6 Dec 2011 13:22:17 -0000 X-SWARE-Spam-Status: No, hits=3.2 required=5.0 tests=AWL, BAYES_00, BOTNET, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vms173003pub.verizon.net (HELO vms173003pub.verizon.net) (206.46.173.3) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Dec 2011 13:21:52 +0000 Received: from [192.168.1.8] ([unknown] [108.15.31.125]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LVS004XUAFVH3E2@vms173003.mailsrvcs.net> for gcc-patches@gcc.gnu.org; Tue, 06 Dec 2011 07:21:32 -0600 (CST) Message-id: <4EDE16DB.1070804@verizon.net> Date: Tue, 06 Dec 2011 08:21:31 -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: gcc-patches , Jason Merrill Subject: [C++ PATCH] ICE with invalid user-defined literals (PR c++/51420) Content-type: multipart/mixed; boundary=------------080503010100010601040004 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 This time with patch. 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 current overload is function_type. 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 182038) +++ gcc/cp/parser.c (working copy) @@ -3563,6 +3563,8 @@ bool found = true; tree fn = OVL_CURRENT (fns); tree argtypes = NULL_TREE; + if (TREE_CODE (TREE_TYPE (fn)) != FUNCTION_TYPE) + return error_mark_node; argtypes = TYPE_ARG_TYPES (TREE_TYPE (fn)); if (argtypes != NULL_TREE) {