https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65695
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.9.2, 5.0
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
4.8 ICEs when using a pointer-to-data-member but not with
pointer-to-member-function, so here is a slightly less reduced version that
compiles with 4.8:
struct Foo;
struct Bar
{
using MemberFuncT = int (Foo::*)();
MemberFuncT h_;
constexpr Bar(MemberFuncT h) : h_{h}
{
}
};
struct Foo
{
int test()
{
return -1;
}
static constexpr Bar bar {&Foo::test};
};
constexpr Bar Foo::bar;
With 4.9.2:
c.cc:20:41: error: ‘const Bar{&Foo::test}’ is not a constant expression
static constexpr Bar bar {&Foo::test};
^
With 5.0:
c.cc:20:41: error: ‘Bar{&Foo::test}’ is not a constant expression
static constexpr Bar bar {&Foo::test};
^