http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58037
Bug ID: 58037
Summary: sizeof... accepted only in some contexts
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nmm1 at cam dot ac.uk
With 4.8.1:
template<int ... Dims>
class weeble {
static constexpr int Ranks[sizeof...(Dims)] = {Dims...};
const int rank = sizeof...(Dims);
};
weeble<3,5> x;
produces:
junk.cpp:4:22: error: expected ';' at end of member declaration
const int rank = sizeof...(Dims);
^
junk.cpp:4:28: error: expected unqualified-id before '...' token
const int rank = sizeof...(Dims);
^
junk.cpp:4:22: error: expected primary-expression at end of input
const int rank = sizeof...(Dims);
^
That doesn't look right, especially as that use of sizeof... is almost
straight out of the standard.
For what it is worth, -v produces:
Using built-in specs.
COLLECT_GCC=/home/nmm/GCC/bin/g++
COLLECT_LTO_WRAPPER=/home/nmm/GCC/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/nmm/GCC --disable-bootstrap
--enable-languages=c,c++,fortran --enable-werror=yes --disable-decimal-float
Thread model: posix
gcc version 4.8.1 (GCC)