[Bug c++/50445] Rejects use of constant expression using a pointer non-type template parameter
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 20 12:48:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50445
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #1)
> The error message is now:
>
> $ /usr/local/bin/g++ -c -Wall -Wextra -pedantic 50445.cc
> 50445.cc: In instantiation of ‘const int X<(& values)>::val0’:
> 50445.cc:7:22: required from here
> 50445.cc:4:19: error: the value of ‘values’ is not usable in a constant
> expression
> static int const val0 = values[0];
> ^~~~
> 50445.cc:1:18: note: ‘values’ was not declared ‘constexpr’
> extern int const values[] = { 1, 2, 3 };
> ^~~~~~
> 50445.cc:7:26: error: size of array ‘array’ is not an integral
> constant-expression
> int array[X<values>::val0];
> ^
> $
>
> ...which I think clears things up. Although maybe the note saying 'values'
> was not declared 'constexpr' could have a fix-it hint added to it showing
> where to insert the 'constexpr'? Putting in WAITING to see what the reporter
> thinks.
No reply so I'm going to assume the new message is enough of an improvement.
More information about the Gcc-bugs
mailing list