[Bug c++/69324] New: non-constexpr function cannot be called in a constexpr initializer even if the full-expression is a constexpr
dreifachstein at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jan 17 06:01:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69324
Bug ID: 69324
Summary: non-constexpr function cannot be called in a constexpr
initializer even if the full-expression is a constexpr
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dreifachstein at gmail dot com
Target Milestone: ---
I think g++ incorrectly assumes a constexpr cannot be created from a
non-constexpr function call.
Here is a test case:
struct T {
static constexpr auto Create() { return 0; }
};
void test()
{
auto v0 = ([](){ return T(); })(); // not a constexpr
static_assert(0 == v0.Create(), ""); // pass
constexpr auto v1 = ([](){ return T(); })().Create(); // error
}
More information about the Gcc-bugs
mailing list