From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17758 invoked by alias); 18 Feb 2006 09:41:24 -0000 Received: (qmail 17714 invoked by alias); 18 Feb 2006 09:41:21 -0000 Date: Sat, 18 Feb 2006 09:41:00 -0000 Message-ID: <20060218094121.17713.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/26266] [4.0/4.1/4.2 regression] Trouble with static const data members in template classes In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mmitchel at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg02037.txt.bz2 List-Id: ------- Comment #14 from mmitchel at gcc dot gnu dot org 2006-02-18 09:41 ------- Subject: Bug 26266 Author: mmitchel Date: Sat Feb 18 09:41:18 2006 New Revision: 111234 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111234 Log: PR c++/26266 * cp-tree.h (cp_finish_decl): Adjust declaration. (grokbitfield): Likewise. (finish_static_data_member_decl): Likewise. * init.c (constant_value_1): Ensure processing_template_decl when folding non-dependent initializers for static data members of dependent types. Return error_mark_node for erroneous initailizers. * class.c (get_vtable_decl): Use finish_decl, not cp_finish_decl. * decl.c (cp_make_fname_decl): Adjust call to cp_finish_decl. (cp_finish_decl): Add init_const_expr_p parameter. Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (finish_decl): Adjust call to cp_finish_decl. (compute_array_index_type): Robustify. (start_method): Use finish_decl, not cp_finish_decl. * rtti.c (emit_tinfo_decl): Likewise. * except.c (initialize_handler_parm): Adjust call to cp_finish_decl. (expand_start_catch_block): Likewise. * cvt.c (build_up_reference): Adjust call to cp_finish_decl. * pt.c (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_expr): Use finish_decl, not cp_finish_decl. (instantiate_decl): Adjust call to cp_finish_decl. * name-lookup.c (pushdecl_top_level_1): Use finish_decl, not cp_finish_decl. * decl2.c (finish_static_data_member_decl): Add init_const_expr_p parameter. (grokfield): Likewise. * parser.c (cp_parser_condition): Check for constant initializers. (cp_parser_init_declarator): Adjust calls to grokfield and cp_finish_decl. Don't set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. PR c++/26266 * g++.dg/template/static22.C: New test. * g++.dg/template/static23.C: New test. * g++.dg/template/static24.C: New test. * g++.dg/template/non-dependent13.C: New test. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/non-dependent13.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/static22.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/static23.C branches/gcc-4_0-branch/gcc/testsuite/g++.dg/template/static24.C Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/class.c branches/gcc-4_0-branch/gcc/cp/cp-tree.h branches/gcc-4_0-branch/gcc/cp/cvt.c branches/gcc-4_0-branch/gcc/cp/decl.c branches/gcc-4_0-branch/gcc/cp/decl2.c branches/gcc-4_0-branch/gcc/cp/except.c branches/gcc-4_0-branch/gcc/cp/init.c branches/gcc-4_0-branch/gcc/cp/name-lookup.c branches/gcc-4_0-branch/gcc/cp/parser.c branches/gcc-4_0-branch/gcc/cp/pt.c branches/gcc-4_0-branch/gcc/cp/rtti.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog branches/gcc-4_0-branch/gcc/testsuite/g++.dg/init/member1.C -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26266