This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50445] Rejects use of constant expression using a pointer non-type template parameter
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 Aug 2017 12:53:24 +0000
- Subject: [Bug c++/50445] Rejects use of constant expression using a pointer non-type template parameter
- Auto-submitted: auto-generated
- References: <bug-50445-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50445
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-08-18
CC| |egallager at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
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.