From patchwork Sat Oct 27 07:57:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 194606 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 82D282C00A3 for ; Sat, 27 Oct 2012 18:57:31 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351929452; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=6FnxhuJ8xKwU1SkwcC3Jk8NeDDw=; b=L+9Jr44QaQBetNW atSpEtWNrVmgM6BWXwUlvMgx+osGeYWgq1ogCnWJapgsDo3buuqTJghD5g0Hgz+E scS1D8ZSVBT0xsIrIAojqqTpizFtsgstyVmAPr6SzMiarKv0Yd34HW+vaI7PYfIS FAI+jot3bEXidUtUKYKJNstobpU8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Cc:Subject:X-URL:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=H4CtgVTqpzWyGGxb369qGapsjKzpU03ITw/vhOsKnz2D13ScBty4F7NdFXZk82 mCtf3FAuxJvVNlUZc4Dcxp4U4vId6vmX70EqxlbdR/kgl9+OswPkSRWthm569y7M Ha12LldHQurT++3viP3vE4QMBLQK2kTGkU5QIqzaSvOb0=; Received: (qmail 21384 invoked by alias); 27 Oct 2012 07:57:28 -0000 Received: (qmail 21375 invoked by uid 22791); 27 Oct 2012 07:57:27 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 27 Oct 2012 07:57:24 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9R7vNgu027328 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 27 Oct 2012 03:57:24 -0400 Received: from localhost (ovpn-116-36.ams2.redhat.com [10.36.116.36]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9R7vMaN016860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 27 Oct 2012 03:57:23 -0400 Received: by localhost (Postfix, from userid 1000) id 18FBE2C0104; Sat, 27 Oct 2012 09:57:22 +0200 (CEST) From: Dodji Seketeli To: GCC Patches Cc: Jason Merrill Subject: [PATCH] PR c++/54466 - ICE with alias template which type-id is const qualified X-URL: http://www.redhat.com Date: Sat, 27 Oct 2012 09:57:21 +0200 Message-ID: <87y5iscppa.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 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 Hello, Consider this short example: template struct X { }; template using Y = const X; using Z = Y; G++ crashes in lookup_class_template_1 while trying to build the alias template instantiation Y. I think this is indirectly due to the fact that lookup_class_template_1 can now yield a const qualified type like 'const X'. As a consequence, the code in lookup_template_class_1 that was trying to access the TYPE_STUB_DECL field of the result of lookup_template_class_1 should now be adjusted to access the TYPE_STUB_DECL of the main variant of the resulting type instead; because qualified types (constructed with build_qualified_type) have their TYPE_STUB_DECL set to NULL. Fixed thus and tested on x86_64-unknown-linux-gnu against trunk. gcc/cp PR c++/54466 * pt.c (lookup_template_class_1): TYPE_STUB_DECL should be accessed on the main variant of the type. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-25.C: New test file. In the example of this patch, g++ crashes when trying to build the alias template Y + struct X { }; + +template + using Y = const X; + +using Z = Y;