* call.c (add_function_candidate): Allow conversions for the copy
parm in list-initialization unless the argument is an init-list.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182495
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-12-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/51553
+ * call.c (add_function_candidate): Allow conversions for the copy
+ parm in list-initialization unless the argument is an init-list.
+
2011-12-19 Jakub Jelinek <jakub@redhat.com>
PR c++/51619
{
lflags |= LOOKUP_COPY_PARM;
/* We allow user-defined conversions within init-lists, but
- not for the copy constructor. */
- if (flags & LOOKUP_NO_COPY_CTOR_CONVERSION)
+ don't list-initialize the copy parm, as that would mean
+ using two levels of braces for the same type. */
+ if ((flags & LOOKUP_NO_COPY_CTOR_CONVERSION)
+ && BRACE_ENCLOSED_INITIALIZER_P (arg))
lflags |= LOOKUP_NO_CONVERSION;
}
else
2011-12-19 Jason Merrill <jason@redhat.com>
+ PR c++/51553
+ * g++.dg/cpp0x/initlist64.C: New.
+
PR c++/51228
* c-c++-common/transparent-union-1.c: New.
--- /dev/null
+// PR c++/51553
+// { dg-options -std=c++0x }
+
+struct X
+{
+ X();
+};
+
+struct Y
+{
+ operator X() const;
+};
+
+struct Z
+{
+ explicit operator X() const;
+};
+
+X a = { Y() };
+X aa = Y();
+
+X b{ Y() };
+X bb(Y());
+
+X c = { Z() }; // { dg-error "" "" { xfail *-*-* } }
+X cc = Z(); // { dg-error "" }
+
+X d{ Z() };
+X dd( Z() );