From: Jason Merrill Date: Sun, 24 Jul 2016 02:35:37 +0000 (-0400) Subject: PR c++/71350 - error recursion with initializer-list X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a6c690f41e0e50ce67dd3d3e791ff9f266842748;p=gcc.git PR c++/71350 - error recursion with initializer-list * decl.c (reshape_init_r): Check complain for missing braces warning. From-SVN: r238684 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 34ebcb818bf..e1e4506690e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-07-23 Jason Merrill + + PR c++/71350 + * decl.c (reshape_init_r): Check complain for missing braces warning. + 2016-07-22 Jason Merrill PR c++/71576 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e5e1121b1d4..08fa95dc0e6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5894,8 +5894,10 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p, } } - warning (OPT_Wmissing_braces, "missing braces around initializer for %qT", - type); + if (complain & tf_warning) + warning (OPT_Wmissing_braces, + "missing braces around initializer for %qT", + type); } /* Dispatch to specialized routines. */ diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype66.C b/gcc/testsuite/g++.dg/cpp0x/decltype66.C new file mode 100644 index 00000000000..76ff1e2e7b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype66.C @@ -0,0 +1,19 @@ +// PR c++/71350 +// { dg-do compile { target c++11 } } + +template +struct Array +{ + T data[N]; +}; + +template +struct Foo +{ + int operator[](const Array& i) const { return 0; } + auto bar() -> decltype((*this)[{1,2}] * 0) { + return *this; // { dg-error "cannot convert" } + } +}; + +template struct Foo;