diff options
author | Jason Merrill <jason@redhat.com> | 2009-12-14 21:11:54 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-12-14 21:11:54 -0500 |
commit | 0857d1f0b1161a03207d64708f083c16880a65f8 (patch) | |
tree | 40cb649be49d08265a63b4d8dbbe9f7dac3ad9e1 /gcc/cp | |
parent | 6ba6f70d7fa8fa889576172a23c199a51abdd045 (diff) | |
download | gcc-0857d1f0b1161a03207d64708f083c16880a65f8.zip gcc-0857d1f0b1161a03207d64708f083c16880a65f8.tar.gz gcc-0857d1f0b1161a03207d64708f083c16880a65f8.tar.bz2 |
re PR c++/42364 (C++ testsuite fails with -g)
PR c++/42364
* pt.c (function_parameter_expanded_from_pack_p): Don't require
a pack to have a name.
(tsubst_decl): Do typedef magic after applying attributes.
From-SVN: r155246
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 40 |
2 files changed, 28 insertions, 19 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf6ecd8..fbfed9f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-12-14 Jason Merrill <jason@redhat.com> + + PR c++/42364 + * pt.c (function_parameter_expanded_from_pack_p): Don't require + a pack to have a name. + (tsubst_decl): Do typedef magic after applying attributes. + 2009-12-15 Paolo Bonzini <bonzini@gnu.org> Shujing Zhao <pearly.zhao@oracle.com> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 68e277e..dfd2399 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2730,15 +2730,13 @@ get_function_template_decl (const_tree primary_func_tmpl_inst) bool function_parameter_expanded_from_pack_p (tree param_decl, tree pack) { - if (DECL_ARTIFICIAL (param_decl) - || !function_parameter_pack_p (pack)) - return false; - - gcc_assert (DECL_NAME (param_decl) && DECL_NAME (pack)); + if (DECL_ARTIFICIAL (param_decl) + || !function_parameter_pack_p (pack)) + return false; - /* The parameter pack and its pack arguments have the same - DECL_PARM_INDEX. */ - return DECL_PARM_INDEX (pack) == DECL_PARM_INDEX (param_decl); + /* The parameter pack and its pack arguments have the same + DECL_PARM_INDEX. */ + return DECL_PARM_INDEX (pack) == DECL_PARM_INDEX (param_decl); } /* Determine whether ARGS describes a variadic template args list, @@ -9273,7 +9271,13 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* Create a new node for the specialization we need. */ r = copy_decl (t); if (type == NULL_TREE) - type = tsubst (TREE_TYPE (t), args, complain, in_decl); + { + if (is_typedef_decl (t)) + type = DECL_ORIGINAL_TYPE (t); + else + type = TREE_TYPE (t); + type = tsubst (type, args, complain, in_decl); + } if (TREE_CODE (r) == VAR_DECL) { /* Even if the original location is out of scope, the @@ -9344,16 +9348,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) } determine_visibility (r); } - /* Preserve a typedef that names a type. */ - else if (TREE_CODE (r) == TYPE_DECL - && DECL_ORIGINAL_TYPE (t) - && type != error_mark_node) - { - DECL_ORIGINAL_TYPE (r) = tsubst (DECL_ORIGINAL_TYPE (t), - args, complain, in_decl); - TREE_TYPE (r) = type = build_variant_type_copy (type); - TYPE_NAME (type) = r; - } if (!local_p) { @@ -9391,6 +9385,14 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) apply_late_template_attributes (&r, DECL_ATTRIBUTES (r), (int) ATTR_FLAG_TYPE_IN_PLACE, args, complain, in_decl); + + /* Preserve a typedef that names a type. */ + if (is_typedef_decl (r)) + { + DECL_ORIGINAL_TYPE (r) = NULL_TREE; + set_underlying_type (r); + } + layout_decl (r, 0); } break; |