diff options
| -rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cp/call.c | 6 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist-array4.C | 9 |
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e873d99..bdad6d9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-13 Jason Merrill <jason@redhat.com> + + PR c++/58636 + * call.c (build_list_conv): Don't try to build a list of references. + 2014-07-13 Edward Smith-Rowland <3dw4rd@verizon.net> PR C++/60209 - Declaration of user-defined literal operator cause error diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4ca6be5..b16c6e4 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -806,6 +806,12 @@ build_list_conv (tree type, tree ctor, int flags, tsubst_flags_t complain) /* But no narrowing conversions. */ flags |= LOOKUP_NO_NARROWING; + /* Can't make an array of these types. */ + if (TREE_CODE (elttype) == REFERENCE_TYPE + || TREE_CODE (elttype) == FUNCTION_TYPE + || VOID_TYPE_P (elttype)) + return NULL; + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val) { conversion *sub diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-array4.C b/gcc/testsuite/g++.dg/cpp0x/initlist-array4.C new file mode 100644 index 0000000..af2045d9b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-array4.C @@ -0,0 +1,9 @@ +// PR c++/58636 +// { dg-do compile { target c++11 } } + +#include <initializer_list> + +// { dg-error "pointer to reference" "" { target *-*-* } 0 } +int foo(std::initializer_list<int&&>); + +int i = foo({ 0 }); // { dg-error "std::initializer_list" } |
