https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83835

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-27
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
      Known to work|                            |6.4.0
            Summary|constexpr constructor       |[7/8 Regression] constexpr
                   |rejected in c++17 mode      |constructor rejected in
                   |(regression WRT c++14)      |c++17 mode (regression WRT
                   |                            |c++14)
     Ever confirmed|0                           |1
      Known to fail|                            |7.2.0, 8.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with the slightly simplified test case below.  Other compilers accept
the code, as does GCC 6.4.0.

The regression was introduced in GCC 7.0 by r240889.

$ cat pr83835.C && gcc -S -Wall -std=c++17 pr83835.C
struct Y {
    struct Z {
        virtual ~Z ();

        constexpr explicit Z (const Y*) { }
    };

    Z z;
    constexpr Y (): z (this) { }
};
pr83835.C: In constructor ‘constexpr Y::Y()’:
pr83835.C:9:32: error: temporary of non-literal type ‘Y::Z’ in a constant
expression
     constexpr Y (): z (this) { }
                                ^
pr83835.C:2:12: note: ‘Y::Z’ is not literal because:
     struct Z {
            ^
pr83835.C:2:12: note:   ‘Y::Z’ has a non-trivial destructor

Reply via email to