diff options
author | Douglas Gregor <doug.gregor@gmail.com> | 2007-11-06 14:37:56 +0000 |
---|---|---|
committer | Doug Gregor <dgregor@gcc.gnu.org> | 2007-11-06 14:37:56 +0000 |
commit | 1ad8aeeb962a281f654be3bc0a7a2dd4015d317b (patch) | |
tree | 83b93ec8d6832f10e12b455400f3daa46f208750 /gcc/cp/class.c | |
parent | 3de36a09ac124ff2b1bf50c822259ca206f88f23 (diff) | |
download | gcc-1ad8aeeb962a281f654be3bc0a7a2dd4015d317b.zip gcc-1ad8aeeb962a281f654be3bc0a7a2dd4015d317b.tar.gz gcc-1ad8aeeb962a281f654be3bc0a7a2dd4015d317b.tar.bz2 |
re PR c++/31439 (ICE with variadic template and broken specialization)
2007-11-06 Douglas Gregor <doug.gregor@gmail.com>
PR c++/31439
PR c++/32114
PR c++/32115
PR c++/32125
PR c++/32126
PR c++/32127
PR c++/32128
PR c++/32253
PR c++/32566
* typeck.c (check_return_expr): Pass address of retval to
check_for_bare_parameter_packs.
* class.c (build_base_field): Tolerate bases that have no layout
due to errors.
(end_of_base): Ditto.
* tree.c (canonical_type_variant): Be careful with
ERROR_MARK_NODE.
* cp-tree.h (check_for_bare_parameter_packs): Now accepts a
tree*.
* pt.c (find_parameter_pack_data): Add set_packs_to_error field,
which states whether parameter packs should be replaced with
ERROR_MARK_NODE.
(find_parameter_packs_r): Pass addresses to cp_walk_tree wherever
possible. If set_packs_to_error is set true, replace the parameter
pack with ERROR_MARK_NODE. Manage our own pointer sets.
(uses_parameter_packs): Don't set parameter packs to
ERROR_MARK_NODE.
(check_for_bare_parameter_packs): Now takes a pointer to a tree,
which may be modified (if it is a parameter pack). Instructs
find_parameter_packs_r to replace parameter packs with
ERROR_MARK_NODE (so that they won't cause errors later on).
(process_template_parm): Pass pointer to
check_for_bare_parameter_packs.
(process_partial_specialization): Replace pack expansions before
the end of the template argument list with ERROR_MARK_NODE.
(push_template_decl_real): Pass pointer to
check_for_bare_parameter_packs. Replace parameter packs not at the
end of the template parameter list with ERROR_MARK_NODE.
(convert_template_argument): Be more careful about using DECL_NAME
on only declarations.
(unify): Can't unify against ERROR_MARK_NODE.
* semantics.c (finish_cond): Pass pointer to
check_for_bare_parameter_packs.
(finish_expr_stmt): Ditto.
(finish_for_expr): Ditto.
(finish_switch_cond): Pass pointer to
check_for_bare_parameter_packs, and call it before we put the
condition into the statement.
(finish_mem_initializers): Pass pointer to
check_for_bare_parameter_packs.
(finish_member_declaration): Ditto.
* parser.c (cp_parser_base_clause): Ditto.
2007-11-06 Douglas Gregor <doug.gregor@gmail.com>
* testsuite/g++.dg/parser/crash36.C: Tweak expected errors.
* testsuite/g++.dg/cpp0x/pr31439.C: New.
* testsuite/g++.dg/cpp0x/pr32114.C: New.
* testsuite/g++.dg/cpp0x/pr32115.C: New.
* testsuite/g++.dg/cpp0x/pr32125.C: New.
* testsuite/g++.dg/cpp0x/pr32126.C: New.
* testsuite/g++.dg/cpp0x/pr32127.C: New.
* testsuite/g++.dg/cpp0x/pr32128.C: New.
* testsuite/g++.dg/cpp0x/pr32253.C: New.
* testsuite/g++.dg/cpp0x/pr32566.C: New.
* testsuite/g++.dg/cpp0x/pr31445.C: Tweak expected errors.
* testsuite/g++.dg/cpp0x/pr31438.C: Ditto.
* testsuite/g++.dg/cpp0x/variadic81.C: Ditto.
* testsuite/g++.dg/cpp0x/pr31432.C: Ditto.
* testsuite/g++.dg/cpp0x/pr31442.C: Ditto.
From-SVN: r129928
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4453b34..e468db3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3613,21 +3613,24 @@ build_base_field (record_layout_info rli, tree binfo, DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; DECL_FIELD_CONTEXT (decl) = t; - DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype); - DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); - DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); - DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); - DECL_MODE (decl) = TYPE_MODE (basetype); - DECL_FIELD_IS_BASE (decl) = 1; - - /* Try to place the field. It may take more than one try if we - have a hard time placing the field without putting two - objects of the same type at the same address. */ - layout_nonempty_base_or_field (rli, decl, binfo, offsets); - /* Add the new FIELD_DECL to the list of fields for T. */ - TREE_CHAIN (decl) = *next_field; - *next_field = decl; - next_field = &TREE_CHAIN (decl); + if (CLASSTYPE_AS_BASE (basetype)) + { + DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype); + DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); + DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); + DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); + DECL_MODE (decl) = TYPE_MODE (basetype); + DECL_FIELD_IS_BASE (decl) = 1; + + /* Try to place the field. It may take more than one try if we + have a hard time placing the field without putting two + objects of the same type at the same address. */ + layout_nonempty_base_or_field (rli, decl, binfo, offsets); + /* Add the new FIELD_DECL to the list of fields for T. */ + TREE_CHAIN (decl) = *next_field; + *next_field = decl; + next_field = &TREE_CHAIN (decl); + } } else { @@ -4423,7 +4426,9 @@ end_of_base (tree binfo) { tree size; - if (is_empty_class (BINFO_TYPE (binfo))) + if (!CLASSTYPE_AS_BASE (BINFO_TYPE (binfo))) + size = TYPE_SIZE_UNIT (char_type_node); + else if (is_empty_class (BINFO_TYPE (binfo))) /* An empty class has zero CLASSTYPE_SIZE_UNIT, but we need to allocate some space for it. It cannot have virtual bases, so TYPE_SIZE_UNIT is fine. */ |