From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25745 invoked by alias); 16 Dec 2009 10:45:13 -0000 Received: (qmail 25434 invoked by uid 48); 16 Dec 2009 10:44:52 -0000 Date: Wed, 16 Dec 2009 10:45:00 -0000 Message-ID: <20091216104452.25433.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/42387] [4.4 / 4.5 Regression] ICE with new expression in class template In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" 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: 2009-12/txt/msg01570.txt.bz2 ------- Comment #5 from jakub at gcc dot gnu dot org 2009-12-16 10:44 ------- This exact spot of ICE can be fixed with e.g.: --- init.c.jj 2009-12-02 09:37:36.000000000 +0100 +++ init.c 2009-12-16 11:32:52.000000000 +0100 @@ -2386,7 +2386,16 @@ build_new (VEC(tree,gc) **placement, tre /* The type allocated must be complete. If the new-type-id was "T[N]" then we are just checking that "T" is complete here, but that is equivalent, since the value of "N" doesn't matter. */ - if (!complete_type_or_else (type, NULL_TREE)) + if (processing_template_decl + && TREE_CODE (type) == ARRAY_TYPE + && TYPE_DOMAIN (type) + && TYPE_MAX_VALUE (TYPE_DOMAIN (type)) + && TREE_SIDE_EFFECTS (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))) + { + if (!complete_type_or_else (TREE_TYPE (type), NULL_TREE)) + return error_mark_node; + } + else if (!complete_type_or_else (type, NULL_TREE)) return error_mark_node; rval = build_new_1 (placement, type, nelts, init, use_global_new, complain); but then we ICE in array_type_nelts_top called from build_new_1. So, either when processing_template_decl and TYPE_MAX_VALUE of ARRAY_TYPE's TYPE_DOMAIN has side-effects we just shouldn't call build_new_1, or build_new_1 will need to be prepared for it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42387