aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-04-22 21:29:35 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-04-22 21:29:35 +0000
commit92a62aad855ff49dbd3c975aed87ed141ff447b4 (patch)
tree0ba13a72c0e5f3f23ed463ff62b80ef65ac60f72 /gcc/cp/decl.c
parent838a4849fab52af1c5d54703b4591d403544dd7f (diff)
downloadgcc-92a62aad855ff49dbd3c975aed87ed141ff447b4.zip
gcc-92a62aad855ff49dbd3c975aed87ed141ff447b4.tar.gz
gcc-92a62aad855ff49dbd3c975aed87ed141ff447b4.tar.bz2
class.c (initialize_array): Don't set TREE_HAS_CONSTRUCTOR on braced initializer.
* class.c (initialize_array): Don't set TREE_HAS_CONSTRUCTOR on braced initializer. * cp-tree.h (BRACE_ENCLOSED_INITIALIZER_P): New macro. * decl.c (reshape_init): Use it. * init.c (perform_member_init): Remove redundant condition. (build_aggr_init): Adjust to handle brace-enclosed initializers correctly. (expand_default_init): Use BRACE_ENCLOSED_INITIALIZER_P. * parser.c (cp_parser_initializer_clause): Do not set TREE_HAS_CONSTRUCTOR on the initializer. * rtti.c (tinfo_base_init): Likewise. (generic_initializer): Likewise. (ptr_initializer): Likewise. (ptm_initializer): Likewise. (class_initializer): Likewise. (get_pseudo_ti_init): Likewise. * typeck2.c (digest_init): Use BRACE_ENCLOSED_INITIALIZER_P. * g++.dg/ext/complit3.C: New test. From-SVN: r81052
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index b228cd0..1793fff 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4151,8 +4151,7 @@ reshape_init (tree type, tree *initp)
enclosed elements. Advance past the brace-enclosed initializer
now. */
if (TREE_CODE (old_init_value) == CONSTRUCTOR
- && TREE_TYPE (old_init_value) == NULL_TREE
- && TREE_HAS_CONSTRUCTOR (old_init_value))
+ && BRACE_ENCLOSED_INITIALIZER_P (old_init_value))
{
*initp = TREE_CHAIN (old_init);
TREE_CHAIN (old_init) = NULL_TREE;
@@ -4222,8 +4221,7 @@ reshape_init (tree type, tree *initp)
else
{
/* Build a CONSTRUCTOR to hold the contents of the aggregate. */
- new_init = build_constructor (type, NULL_TREE);
- TREE_HAS_CONSTRUCTOR (new_init) = 1;
+ new_init = build_constructor (NULL_TREE, NULL_TREE);
if (CLASS_TYPE_P (type))
{
@@ -4283,7 +4281,8 @@ reshape_init (tree type, tree *initp)
}
}
}
- else if ((TREE_CODE (type) == ARRAY_TYPE)|| (TREE_CODE (type) == VECTOR_TYPE))
+ else if (TREE_CODE (type) == ARRAY_TYPE
+ || TREE_CODE (type) == VECTOR_TYPE)
{
tree index;
tree max_index;
@@ -4399,7 +4398,8 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
init = grok_reference_init (decl, type, init, cleanup);
else if (init)
{
- if (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
+ if (TREE_CODE (init) == CONSTRUCTOR
+ && BRACE_ENCLOSED_INITIALIZER_P (init))
{
/* [dcl.init] paragraph 13,
If T is a scalar type, then a declaration of the form
@@ -4424,15 +4424,13 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
array size from the initializer. */
maybe_deduce_size_from_array_init (decl, init);
type = TREE_TYPE (decl);
- if (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init))
- TREE_TYPE (init) = type;
if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
{
if (TREE_CODE (type) == ARRAY_TYPE)
goto initialize_aggr;
else if (TREE_CODE (init) == CONSTRUCTOR
- && TREE_HAS_CONSTRUCTOR (init))
+ && BRACE_ENCLOSED_INITIALIZER_P (init))
{
if (TYPE_NON_AGGREGATE_CLASS (type))
{