From patchwork Mon Jul 5 11:52:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 57888 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 019EAB6EF1 for ; Mon, 5 Jul 2010 21:52:50 +1000 (EST) Received: (qmail 25579 invoked by alias); 5 Jul 2010 11:52:48 -0000 Received: (qmail 25564 invoked by uid 22791); 5 Jul 2010 11:52:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet10.oracle.com (HELO rcsinet10.oracle.com) (148.87.113.121) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Jul 2010 11:52:41 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o65BqbeY014516 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jul 2010 11:52:39 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o64MF8S8017501; Mon, 5 Jul 2010 11:52:36 GMT Received: from abhmt020.oracle.com by acsmt353.oracle.com with ESMTP id 381200951278330743; Mon, 05 Jul 2010 04:52:23 -0700 Received: from [192.168.0.4] (/79.52.240.176) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Jul 2010 04:52:22 -0700 Message-ID: <4C31C773.3050000@oracle.com> Date: Mon, 05 Jul 2010 13:52:19 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/3.0.4-1.1.1 Thunderbird/3.0.4 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 44625 X-IsSubscribed: yes 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 Hi, I have this patchlet for another case where we use BASELINK_P on NULL_TREE. Tested x86_64-linux. I propose to apply it to mainline and 4_5-branch only and then close the PR: it's a regression, but just a P5 ice-on-invalid. Thanks, Paolo. ////////////////// /cp 2010-07-05 Paolo Carlini PR c++/44625 * pt.c (tsubst_copy_and_build): Do not apply BASELINK_P on NULL_TREE. /testsuite 2010-07-05 Paolo Carlini PR c++/44625 * g++.dg/template/crash102.C: New. Index: testsuite/g++.dg/template/crash102.C =================================================================== --- testsuite/g++.dg/template/crash102.C (revision 0) +++ testsuite/g++.dg/template/crash102.C (revision 0) @@ -0,0 +1,19 @@ +// PR c++/44625 +// { dg-do compile } +// { dg-options "" } + +template struct Vec { // { dg-message "note" } + Vec& operator^=(Vec& rhs) { + union { + struct {FP_ x,y,z;}; + }; // { dg-error "anonymous struct" } + y*rhs.z() - z*rhs.y(); // { dg-error "no member" } + return *this; + } + Vec& operator^(Vec& rhs) { + return Vec(*this)^=rhs; // { dg-message "instantiated" } + } +}; +Vec v(3,4,12); // { dg-error "no matching" } +Vec V(12,4,3); // { dg-error "no matching" } +Vec c = v^V; // { dg-message "instantiated" } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 161825) +++ cp/pt.c (working copy) @@ -12625,7 +12625,9 @@ tsubst_copy_and_build (tree t, { tree object; tree object_type; - tree member; + tree member = TREE_OPERAND (t, 1); + if (!member) + return error_mark_node; object = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0), args, complain, in_decl); @@ -12634,7 +12636,6 @@ tsubst_copy_and_build (tree t, mark_used (object); object_type = TREE_TYPE (object); - member = TREE_OPERAND (t, 1); if (BASELINK_P (member)) member = tsubst_baselink (member, non_reference (TREE_TYPE (object)),