https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83835
Bug ID: 83835
Summary: constexpr constructor rejected in c++17 mode
(regression WRT c++14)
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pdimov at gmail dot com
Target Milestone: ---
This code:
```
class X
{
public:
virtual ~X();
};
class Y
{
private:
class Z: public X
{
private:
Y const * p_;
public:
constexpr explicit Z( Y const * p ): p_( p ) {}
};
Z z_;
public:
constexpr Y() noexcept: z_( this ) {}
};
int main()
{
}
```
is accepted in C++14 mode, and in C++1z mode by g++ 5 or 6, but fails in C++17
mode under g++ 7 or 8 with
```
error: temporary of non-literal type 'Y::Z' in a constant expression
```