From: Jason Merrill Date: Thu, 14 Apr 2011 15:00:15 +0000 (-0400) Subject: re PR c++/48531 ([C++0x][SFINAE] Hard errors with arrays of unknown bound) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2a009c710b96a3dcb81eba7ff574fd53f68fea5;p=gcc.git re PR c++/48531 ([C++0x][SFINAE] Hard errors with arrays of unknown bound) PR c++/48531 * init.c (build_value_init_noctor): Check complain consistently. From-SVN: r172434 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1b60dd439dd..64ea98e1feb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-04-14 Jason Merrill + PR c++/48531 + * init.c (build_value_init_noctor): Check complain consistently. + PR c++/48557 * typeck.c (cp_build_binary_op): Don't decay void operands. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 32afa03f538..fad7f0c3004 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -422,7 +422,9 @@ build_value_init_noctor (tree type, tsubst_flags_t complain) as we don't know the size of the array yet. */ if (max_index == error_mark_node) { - error ("cannot value-initialize array of unknown bound %qT", type); + if (complain & tf_error) + error ("cannot value-initialize array of unknown bound %qT", + type); return error_mark_node; } gcc_assert (TREE_CODE (max_index) == INTEGER_CST); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a5f5ae9069..3eca0d40393 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-04-14 Jason Merrill + * g++.dg/cpp0x/sfinae15.C: New. + * g++.dg/cpp0x/sfinae14.C: New. * g++.dg/ext/vla10.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae15.C b/gcc/testsuite/g++.dg/cpp0x/sfinae15.C new file mode 100644 index 00000000000..595ca40b555 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae15.C @@ -0,0 +1,12 @@ +// PR c++/48531 +// { dg-options -std=c++0x } + +template +char f(int); + +template +char (&f(...))[2]; + +static_assert(sizeof(f(0)) != 1, "Error");