http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58102
Bug ID: 58102
Summary: rejects valid initialization of constexpr object with
mutable member
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Given
struct S {
mutable int n;
constexpr S() : n() {}
};
GCC correctly accepts:
constexpr S s {};
but incorrectly rejects:
constexpr S s = {};
saying:
<stdin>: At global scope:
<stdin>:5:20: error: ‘const S’ cannot be the type of a complete constant
expression because it has mutable sub-objects
Per core issue 1405, both the above cases are valid.