[Bug c++/104041] static_assert failure triggered by non-selected template specialization

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 15 09:03:51 GMT 2022


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Since the value that is done in the static_assert is not value dependent, it is
rejected at the definition time of C<T>::C<T>.

This is correct. 
Can you use either do the following instead:
template <typename T> struct C
{
    C(T) = delete;
};
Which requires a specialization for C<T>::C<T> so it will not be a deleted
constructor.


More information about the Gcc-bugs mailing list