From patchwork Thu Jun 23 11:08:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 101607 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 C90E3B6F87 for ; Thu, 23 Jun 2011 21:07:41 +1000 (EST) Received: (qmail 15064 invoked by alias); 23 Jun 2011 11:07:40 -0000 Received: (qmail 15056 invoked by uid 22791); 23 Jun 2011 11:07:39 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp204.alice.it (HELO smtp204.alice.it) (82.57.200.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Jun 2011 11:07:23 +0000 Received: from [192.168.1.4] (79.52.194.95) by smtp204.alice.it (8.5.124.08) id 4DE62ADD02255FB6; Thu, 23 Jun 2011 13:07:22 +0200 Message-ID: <4E031E9C.8090502@oracle.com> Date: Thu, 23 Jun 2011 13:08:12 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 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, a patchlet for a pretty old ice-on-invalid regression. Tested x86_64-linux. Ok for mainline? Thanks, Paolo. //////////////// /cp 2011-06-23 Paolo Carlini PR c++/44625 * pt.c (tsubst_copy_and_build): Do not use BASELINK_P on a NULL_TREE. /testsuite 2011-06-23 Paolo Carlini PR c++/44625 * g++.dg/template/crash107.C: New. Index: testsuite/g++.dg/template/crash107.C =================================================================== --- testsuite/g++.dg/template/crash107.C (revision 0) +++ testsuite/g++.dg/template/crash107.C (revision 0) @@ -0,0 +1,20 @@ +// 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" } + X = y*rhs.z() - z*rhs.y(); // { dg-error "not declared|no member" } + } + Vec& operator^(Vec& rhs) { + return Vec(*this)^=rhs; // { dg-message "required" } + } +}; +Vec v(3,4,12); // { dg-error "no matching" } +// { dg-message "note" { target *-*-* } 16 } +Vec V(12,4,3); // { dg-error "no matching" } +// { dg-message "note" { target *-*-* } 18 } +Vec c = v^V; // { dg-message "required" } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 175328) +++ cp/pt.c (working copy) @@ -13252,6 +13252,9 @@ tsubst_copy_and_build (tree t, object_type = TREE_TYPE (object); member = TREE_OPERAND (t, 1); + if (!member) + return error_mark_node; + if (BASELINK_P (member)) member = tsubst_baselink (member, non_reference (TREE_TYPE (object)),