http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50445
Bug #: 50445
Summary: Rejects use of constant expression using a pointer
non-type template parameter
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
This is rejected by GCC:
extern int const values[] = { 1, 2, 3 };
template<int const *values> struct X {
static int const val0 = values[0];
};
int array[X<values>::val0];
GCC error message:
error: non-constant in-class initialization invalid for static member
'X<((const int*)(& values))>::val0'
However, as far as I can see, "values[0]" is a valid integral constant
expression.