http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53836
--- Comment #1 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> 2012-07-03
08:28:59 UTC ---
A similar problem happens when template-type parameters are involved.
// -- test2.cc
template <int N>
struct A { };
template <typename Q>
void g2()
{
const int M ( sizeof(Q) );
A<M> a;
}
void h()
{
g2<int>();
}
$ g++ -c test2.cc
test2.cc: In function ‘void g2()’:
test2.cc:8:8: error: the value of ‘M’ is not usable in a constant expression
test2.cc:7:15: note: ‘M’ was not initialized with a constant expression
test2.cc:8:8: note: in template argument for type ‘int’
test2.cc:8:11: error: invalid type in declaration before ‘;’ token
Should I open another PR for that one?