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:
parent
0ba8746d0a
commit
5c77749e30
@ -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.
|
||||
|
||||
|
@ -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 "
|
||||
|
@ -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>
|
||||
|
12
gcc/testsuite/g++.dg/cpp0x/initlist40.C
Normal file
12
gcc/testsuite/g++.dg/cpp0x/initlist40.C
Normal 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" }
|
||||
}
|
Loading…
Reference in New Issue
Block a user