X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fcp%2Fpt.c;h=13bb5aadf4d185bf74781d7e07217b7b15560567;hp=a58dba29ee3bfc02a7eb33ae958068e7a4b302bc;hb=103883f0f1eefadcb1e39ce483a4612db89ebeba;hpb=6a4a22d44c51033f662e8946872c42fb2709c47c diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a58dba29ee3..13bb5aadf4d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3571,6 +3571,9 @@ end_template_parm_list (tree parms) next = TREE_CHAIN (parm); TREE_VEC_ELT (saved_parmlist, nparms) = parm; TREE_CHAIN (parm) = NULL_TREE; + if (TREE_CODE (TREE_VALUE (parm)) == TYPE_DECL) + TEMPLATE_TYPE_PARM_SIBLING_PARMS (TREE_TYPE (TREE_VALUE (parm))) = + current_template_parms; } --processing_template_parmlist; @@ -3717,15 +3720,17 @@ maybe_update_decl_type (tree orig_type, tree scope) TYPENAME_TYPEs and SCOPE_REFs that were previously dependent. */ tree args = current_template_args (); tree auto_node = type_uses_auto (type); + tree pushed; if (auto_node) { tree auto_vec = make_tree_vec (1); TREE_VEC_ELT (auto_vec, 0) = auto_node; args = add_to_template_args (args, auto_vec); } - push_scope (scope); + pushed = push_scope (scope); type = tsubst (type, args, tf_warning_or_error, NULL_TREE); - pop_scope (scope); + if (pushed) + pop_scope (scope); } if (type == error_mark_node) @@ -4548,6 +4553,9 @@ push_template_decl_real (tree decl, bool is_friend) if (current == decl) current = ctx; + else if (current == NULL_TREE) + /* Can happen in erroneous input. */ + break; else current = (TYPE_P (current) ? TYPE_CONTEXT (current) @@ -4619,9 +4627,6 @@ template arguments to %qD do not match original template %qD", tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i)); if (TREE_CODE (parm) == TEMPLATE_DECL) DECL_CONTEXT (parm) = tmpl; - - if (TREE_CODE (TREE_TYPE (parm)) == TEMPLATE_TYPE_PARM) - DECL_CONTEXT (TYPE_NAME (TREE_TYPE (parm))) = tmpl; } } @@ -9015,7 +9020,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) specialize R. */ gen_tmpl = most_general_template (DECL_TI_TEMPLATE (t)); argvec = tsubst_template_args (DECL_TI_ARGS - (DECL_TEMPLATE_RESULT (gen_tmpl)), + (DECL_TEMPLATE_RESULT + (DECL_TI_TEMPLATE (t))), args, complain, in_decl); /* Check to see if we already have this specialization. */