This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65695] [4.9/5 Regression] NSDMI calling constexpr constructor with pointer-to-member is not a constant expression
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Apr 2015 11:08:27 +0000
- Subject: [Bug c++/65695] [4.9/5 Regression] NSDMI calling constexpr constructor with pointer-to-member is not a constant expression
- Auto-submitted: auto-generated
- References: <bug-65695-4 at http dot gcc dot gnu dot org/bugzilla/>
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};
^