From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17202 invoked by alias); 13 Nov 2012 16:08:17 -0000 Received: (qmail 16966 invoked by uid 55); 13 Nov 2012 16:07:51 -0000 From: "dodji at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54466] [C++11] Recursive Type Alias, Member Function Pointer, Segmentation Fault Date: Tue, 13 Nov 2012 16:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: dodji at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg01171.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54466 --- Comment #10 from Dodji Seketeli 2012-11-13 16:07:50 UTC --- Author: dodji Date: Tue Nov 13 16:07:39 2012 New Revision: 193479 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193479 Log: PR c++/54466 - ICE with alias template which type-id is const qualified 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 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 (and that is TYPE_MAIN_DECL); 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-26.C: New test file. In the example of this patch, g++ crashes when trying to build the alias template Y