http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53972
Bug #: 53972 Summary: array constant expression expression not valid as template argument Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: f...@gcc.gnu.org Instantiating sub1 failes with: bug.cc:10:24: error: ‘array’ is not a constant expression return Constify<array[I]>::value; This is inconsistent because sub2 shows that the array subscript is recognized as a constant expression in other context. template <unsigned I> struct Constify { enum { value = I }; }; template <unsigned N> constexpr char sub1(const char (&array)[N], unsigned I) { return Constify<array[I]>::value; } template <unsigned N> constexpr char sub2(const char (&array)[N], unsigned I) { return array[I]; } int main() { sub1("foo", 2); enum { value = sub2("foo", 2) }; Constify<value>::value; }