diff options
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist36.C | 21 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5944313..1cb2baf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-06-01 Jason Merrill <jason@redhat.com> + + PR c++/44358 + * call.c (build_list_conv): Set list-initialization flags properly. + 2010-06-01 Nathan Froyd <froydnj@codesourcery.com> * typeck2.c (build_x_arrow): Make types_memoized a VEC. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 64e2e50..4062702 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -589,6 +589,12 @@ build_list_conv (tree type, tree ctor, int flags) unsigned i; tree val; + /* Within a list-initialization we can have more user-defined + conversions. */ + flags &= ~LOOKUP_NO_CONVERSION; + /* But no narrowing conversions. */ + flags |= LOOKUP_NO_NARROWING; + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val) { conversion *sub diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd4fdc3..3bdfeff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-01 Jason Merrill <jason@redhat.com> + + PR c++/44358 + * g++.dg/cpp0x/initlist36.C: New. + 2010-05-31 Jan Hubicka <jh@suse.cz> * testsuite/gcc.dg/noreturn-8.c: New testcase. diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist36.C b/gcc/testsuite/g++.dg/cpp0x/initlist36.C new file mode 100644 index 0000000..a3305e1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist36.C @@ -0,0 +1,21 @@ +// PR c++/44358 +// { dg-options "-std=c++0x" } + +#include <initializer_list> + +struct A +{ + A(int); +}; + +struct B +{ + B(std::initializer_list<A>); +}; + +void f (B b); +int main() +{ + B b0 = {{1}}; + B b1 = {{1.0}}; // { dg-error "narrowing" } +} |