https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123955
--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The workaround is to define the partial specialization of InvariantClass as:
template <typename T, std::same_as<void> U>
requires InvariantClassLike<T, U>
class InvariantClass<T, U> {
...
