diff options
author | Jason Merrill <jason@redhat.com> | 2010-05-24 14:38:16 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-05-24 14:38:16 -0400 |
commit | 611d6f76fe8eae737566fb809f61b0c094ef92c9 (patch) | |
tree | 538a9f415da25d0233304dc40b74faf54a537d08 /gcc/cp | |
parent | e20463aaf048d91eee354cc784819d1988abd2c2 (diff) | |
download | gcc-611d6f76fe8eae737566fb809f61b0c094ef92c9.zip gcc-611d6f76fe8eae737566fb809f61b0c094ef92c9.tar.gz gcc-611d6f76fe8eae737566fb809f61b0c094ef92c9.tar.bz2 |
re PR c++/41510 ([C++0x] std::complex vs. initialization lists)
PR c++/41510
* decl.c (check_initializer): Don't wrap an init-list in a
TREE_LIST.
* init.c (build_aggr_init): Don't assume copy-initialization if
init has CONSTRUCTOR_IS_DIRECT_INIT.
* call.c (build_new_method_call): Sanity check.
From-SVN: r159792
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/call.c | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/init.c | 4 |
4 files changed, 14 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0454e6..2a3a8a0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2010-05-24 Jason Merrill <jason@redhat.com> + + PR c++/41510 + * decl.c (check_initializer): Don't wrap an init-list in a + TREE_LIST. + * init.c (build_aggr_init): Don't assume copy-initialization if + init has CONSTRUCTOR_IS_DIRECT_INIT. + * call.c (build_new_method_call): Sanity check. + 2010-05-24 Nathan Froyd <froydnj@codesourcery.com> * rtti.c (tinfo_base_init): Use build_constructor instead of diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 3cb30a5..890ab88 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6350,7 +6350,8 @@ build_new_method_call (tree instance, tree fns, VEC(tree,gc) **args, && BRACE_ENCLOSED_INITIALIZER_P (VEC_index (tree, *args, 0)) && CONSTRUCTOR_IS_DIRECT_INIT (VEC_index (tree, *args, 0))) { - gcc_assert (VEC_length (tree, *args) == 1); + gcc_assert (VEC_length (tree, *args) == 1 + && !(flags & LOOKUP_ONLYCONVERTING)); list = VEC_index (tree, *args, 0); if (TYPE_HAS_LIST_CTOR (basetype)) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 95ae8eb..5420f71 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5278,7 +5278,6 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) error ("in C++98 %qD must be initialized by constructor, " "not by %<{...}%>", decl); - init = build_tree_list (NULL_TREE, init); } else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_VECTOR_OPAQUE (type)) { diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1fb5eb0..bf80c09 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1240,7 +1240,9 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) TREE_READONLY (exp) = 0; TREE_THIS_VOLATILE (exp) = 0; - if (init && TREE_CODE (init) != TREE_LIST) + if (init && TREE_CODE (init) != TREE_LIST + && !(BRACE_ENCLOSED_INITIALIZER_P (init) + && CONSTRUCTOR_IS_DIRECT_INIT (init))) flags |= LOOKUP_ONLYCONVERTING; if (TREE_CODE (type) == ARRAY_TYPE) |