[Bug c++/65695] [4.9/5 Regression] NSDMI calling constexpr constructor with pointer-to-member is not a constant expression

jaehnesn at gmx dot de gcc-bugzilla@gcc.gnu.org
Fri Apr 10 12:02:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65695

--- Comment #10 from Sebastian Jähne <jaehnesn at gmx dot de> ---
(In reply to Daniel Krügler from comment #9)
> (In reply to Sebastian Jähne from comment #8)
> > [..] However, please remember that you are using a
> > constexpr static member to store this address. Constexpr are evaluated at
> > compile time. 
> 
> Yes.
> 
> > Correct me if I'm wrong, but as far as I know, you can only
> > take the address of a member function at runtime.
> 
> That is a wrong assumption. It is a valid constant expression to retrieve a
> pointer-to-member address.

I made this assumption on the fact that your code runs when not using a
constexpr. I will investigate the exact requirements for constexpr in the
standard and reply when I find something helpful.


More information about the Gcc-bugs mailing list