A possible bug

Ivo Doko ivo.doko@gmail.com
Tue Oct 7 09:16:00 GMT 2014


On 2014-10-07 10:57, Jonathan Wakely wrote:
> It's probably simply
> https://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition

Thanks for the reply.

What you propose makes sense. At least, it definitely explains why the 
error appears only without compiler optimisation (that was driving me 
insane).

However, the only functions which access those static constexpr 
variables are member functions of the very class in which those 
variables are defined (or actually, there is only one function, because 
only one overload of xorshift_engine::xorshiftgen (in file xorshift.h) 
will be enabled at compile-time, depending on the class templete 
parameters). As far as I can see, the problem should happen only if 
static const(expr) variables are accessed outside the class/struct body.

Besides, this doesn't explain why the error happens for shift_2 and 
shift_3 but not for shift_1 (keep in mind - function 
xorshift_engine::xorshiftgen always accesses each of these three static 
constexpr variables, in order).



More information about the Gcc-help mailing list