[Bug c++/71954] template partial specialization for constexpr error

lichray at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 31 04:56:28 GMT 2022


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

Zhihao Yuan <lichray at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lichray at gmail dot com

--- Comment #5 from Zhihao Yuan <lichray at gmail dot com> ---
Please fix. The workaround is to write

struct Struct {
    template <typename T, typename = void>
    constexpr static bool use_cond = false;
};

template <typename T>
constexpr bool Struct::use_cond<T, void> = true;

But when the enclosing context is a class template, writing such a partial
specialization will be very tedious.


More information about the Gcc-bugs mailing list