From patchwork Tue Mar 10 19:16:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 448677 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9E6C3140083 for ; Wed, 11 Mar 2015 06:16:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=X822ibmI; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=qRiOymb8Wjz4ECRMMVQQJO/5xFbDr oViR3VoHSDm/DJN8fFZBienFedfoONf2D23nl66mXy4DHvhle4xMjHOIOgc58qZr Yu2XHyy4G1CldXXtYPVb3Fg+z98Fnee/QhSHXBZKHfLYe/K7YNeQMz/XsWB9lKJH iPjC7RzddDEEQU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=OjJLuqa6sQ9HVtsurnVgC/kQdX4=; b=X82 2ibmIA7Zvb9VKz5aKkp1d9yNUZa3W2eK8pKoL+5oAvxfy1HUTzMQKwvMooZ+pmUP ahiefdjaRd8A8jqLjSou8B+HRYxrb+smt3gEgg+gKb+xRq5oQI7GrFUAEgNwKU9P dPQUwGqqnmUQWcUIWrFFDzcuXl5H9wuaclYcN3V0= Received: (qmail 128731 invoked by alias); 10 Mar 2015 19:16:23 -0000 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 Received: (qmail 128717 invoked by uid 89); 10 Mar 2015 19:16:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 10 Mar 2015 19:16:22 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2AJGJrx020866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 10 Mar 2015 15:16:20 -0400 Received: from tucnak.zalov.cz (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2AJGHLa011420 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 10 Mar 2015 15:16:18 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t2AJGGP1009311; Tue, 10 Mar 2015 20:16:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t2AJGF2Q009310; Tue, 10 Mar 2015 20:16:15 +0100 Date: Tue, 10 Mar 2015 20:16:15 +0100 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [committed] Fix parsing_nsdmi (PR c++/65127) Message-ID: <20150310191615.GJ1746@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi! current_class_ptr could be just NULL or a PARM_DECL in the past, but now it can also be ADDR_EXPR of a PLACEHOLDER_EXPR, which obviously doesn't have DECL_CONTEXT. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, Jason acked it in the PR, committed to trunk. 2015-03-10 Jakub Jelinek PR c++/65127 * parser.c (parsing_nsdmi): Don't return true if current_class_ptr is not a PARM_DECL. * g++.dg/cpp0x/pr65127.C: New test. Jakub --- gcc/cp/parser.c.jj 2015-03-10 07:37:56.000000000 +0100 +++ gcc/cp/parser.c 2015-03-10 18:12:10.652923617 +0100 @@ -18314,7 +18314,9 @@ parsing_nsdmi (void) { /* We recognize NSDMI context by the context-less 'this' pointer set up by the function above. */ - if (current_class_ptr && DECL_CONTEXT (current_class_ptr) == NULL_TREE) + if (current_class_ptr + && TREE_CODE (current_class_ptr) == PARM_DECL + && DECL_CONTEXT (current_class_ptr) == NULL_TREE) return true; return false; } --- gcc/testsuite/g++.dg/cpp0x/pr65127.C.jj 2015-03-10 18:12:46.912341409 +0100 +++ gcc/testsuite/g++.dg/cpp0x/pr65127.C 2015-03-10 18:12:59.980131583 +0100 @@ -0,0 +1,16 @@ +// PR c++/65127 +// { dg-do compile { target c++11 } } + +template +void +foo () +{ + static int i {100}; + struct { int id {i++}; } j; +} + +int +main () +{ + foo<0> (); +}