* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159792
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
&& 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))
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))
{
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)
+2010-05-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/41510
+ * g++.dg/cpp0x/initlist35.C: New.
+ * g++.dg/init/brace6.C: Adjust.
+
2010-05-24 Paul Brook <paul@codesourcery.com>
* gcc.target/arm/frame-pointer-1.c: New test.
--- /dev/null
+// PR c++/41510
+// { dg-options "-std=c++0x" }
+
+struct B
+{
+ B(int, int);
+};
+struct A
+{
+ A(int, int);
+ A(const B&);
+};
+
+void f()
+{
+ A a = { 1, 2 };
+};
+
+template <class T> void g()
+{
+ A a = { 1, 2 };
+};
+
+template void g<int>();
};
struct B {
- B(const B&); // { dg-message "candidate" }
+ B(const B&);
int b;
};
int i = { 1 };
int j = { 1, 2 }; /* { dg-error "requires one element" } */
A a = { 6 }; /* { dg-error "initialize" } */
- B b = { 6 }; /* { dg-error "initialize" } */
+ B b = { 6 }; /* { dg-error "" } */
C c = { 6 }; /* { dg-error "too many initializers" } */
D d = { 6 };
}