call.c (convert_like_real): Don't complain about list-value-initialization from an explicit constructor.

* call.c (convert_like_real): Don't complain about
	list-value-initialization from an explicit constructor.

From-SVN: r160807
This commit is contained in:
Jason Merrill 2010-06-15 15:59:02 -04:00 committed by Jason Merrill
parent 0ba8746d0a
commit 5c77749e30
4 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2010-06-15 Jason Merrill <jason@redhat.com>
* call.c (convert_like_real): Don't complain about
list-value-initialization from an explicit constructor.
* decl.c (duplicate_decls): Use DECL_IS_BUILTIN rather than test
DECL_SOURCE_LOCATION directly.

View File

@ -4956,7 +4956,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
/* When converting from an init list we consider explicit
constructors, but actually trying to call one is an error. */
if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn))
if (DECL_NONCONVERTING_P (convfn) && DECL_CONSTRUCTOR_P (convfn)
/* Unless we're calling it for value-initialization from an
empty list, since that is handled separately in 8.5.4. */
&& cand->num_convs > 0)
{
if (complain & tf_error)
error ("converting to %qT from initializer list would use "

View File

@ -1,5 +1,7 @@
2010-06-15 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist40.C: New.
* g++.dg/cpp0x/initlist39.C: New.
2010-06-15 Sebastian Pop <sebastian.pop@amd.com>

View File

@ -0,0 +1,12 @@
// { dg-options "-std=c++0x" }
struct A
{
explicit A(int = 42);
};
int main()
{
A a1 = { };
A a2 = { 24 }; // { dg-error "explicit" }
}