[Bug c++/78022] constexpr int template rejected unless constructor is used before hand

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 12 14:31:00 GMT 2018


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2016-10-19 00:00:00         |2018-2-12
      Known to fail|                            |8.0

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Still fails on trunk (and Clang-5+ as reported). Clang-4 and EDG 4.14 accept
it.

Slightly reduced:

template<typename T>
struct A
{
        template<typename... Args>
                constexpr A(Args&&...){}
};

struct B : public A<int>
{
        using A<int>::A;
};

// Uncommenting the following line makes this file compile.
//constexpr B p{0};
// Commenting the following line makes this file compile.
template<typename>
struct X
{
        X()
        {
                // The following line is fine.
                const B b0{0};
                // The following line produces an error.
                constexpr B b1{0};
        }
};


More information about the Gcc-bugs mailing list