On Tue, Jun 29, 2021 at 03:50:27PM -0400, Jason Merrill wrote: > On 6/29/21 3:25 PM, Marek Polacek wrote: > > --- a/gcc/testsuite/g++.dg/cpp0x/auto3.C > > +++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C > > @@ -10,7 +10,7 @@ auto x; // { dg-error "auto" } > > auto i = 42, j = 42.0; // { dg-error "auto" } > > // New CWG issue > > Let's at least update this comment to quote [dcl.type.auto.deduct]/2: "T > shall not be an array type". I guess "unable to deduce" is a suitable > diagnostic for that error.
Fixed. > > diff --git a/gcc/testsuite/g++.dg/diagnostic/auto1.C > > b/gcc/testsuite/g++.dg/diagnostic/auto1.C > > index ee2eefd59aa..9d9979e3fdc 100644 > > --- a/gcc/testsuite/g++.dg/diagnostic/auto1.C > > +++ b/gcc/testsuite/g++.dg/diagnostic/auto1.C > > @@ -1,4 +1,5 @@ > > // PR c++/86915 > > // { dg-do compile { target c++17 } } > > +// Allowed since DR2397. > > Well, not really; any attempt to use this template should hit the same > problem as above of trying to do auto deduction where T is an array type. > Please add to the testcase to get the error. Hmm, this template<auto [1]> struct S { }; static int arr[1]; S<arr> s; won't give an error: I think it's because we coerce the auto tparm into 'auto*' before deducing and so don't get the type mismatch error. That seems to be in line with how 'template<int [1]>' works, though. So I think we don't need to change this in the patch. Do you agree? Marek