From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29285 invoked by alias); 26 Oct 2011 20:04:36 -0000 Received: (qmail 29270 invoked by uid 22791); 26 Oct 2011 20:04:34 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Oct 2011 20:04:21 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9QK4Jnk026000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Oct 2011 20:04:19 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9QK4IcJ026830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Oct 2011 20:04:18 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9QK4C8V008652; Wed, 26 Oct 2011 15:04:12 -0500 Received: from [192.168.1.4] (/79.51.11.135) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Oct 2011 13:04:12 -0700 Message-ID: <4EA867B7.7050406@oracle.com> Date: Wed, 26 Oct 2011 20:31:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch / RFC] PR 50864 Content-Type: multipart/mixed; boundary="------------030404050005030809020102" X-IsSubscribed: yes 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/msg02395.txt.bz2 This is a multi-part message in MIME format. --------------030404050005030809020102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 308 Hi, one more / RFC, for the ICE on invalid part of these issues with '->'. The below tries to catch the problem very early, in cp_parser_postfix_dot_deref_expression and apparently works fine, passes the testsuite, etc. Is it too early? Is the check tight enough? Thanks, Paolo. ////////////////////// --------------030404050005030809020102 Content-Type: text/plain; name="patch_50864_draft" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_50864_draft" Content-length: 1164 Index: testsuite/g++.dg/template/crash109.C =================================================================== --- testsuite/g++.dg/template/crash109.C (revision 0) +++ testsuite/g++.dg/template/crash109.C (revision 0) @@ -0,0 +1,10 @@ +// PR c++/50864 + +namespace impl +{ + template T create(); +} + +template () -> impl::create())> // { dg-error "not a class member" } +struct foo; Index: cp/parser.c =================================================================== --- cp/parser.c (revision 180532) +++ cp/parser.c (working copy) @@ -5673,6 +5673,15 @@ cp_parser_postfix_dot_deref_expression (cp_parser { if (name != error_mark_node && !BASELINK_P (name) && parser->scope) { + if (TREE_CODE (parser->scope) == NAMESPACE_DECL + && TREE_CODE (postfix_expression) == ARROW_EXPR) + { + error_at (token->location, "%<%D::%D%> is not a class member", + parser->scope, name); + parser->context->object_type = NULL_TREE; + return error_mark_node; + } + name = build_qualified_name (/*type=*/NULL_TREE, parser->scope, name, --------------030404050005030809020102--