[libcxx-commits] [libcxx] [libc++] Verifies std::forward_like's mandates clause. (PR #127318)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 28 01:17:38 PST 2025
philnik777 wrote:
> > > > > Can't we test all of this with SFINAE tests instead?
> > > >
> > > >
> > > > I don't think we can. With SFINAE we test a constraint clause and this is a mandates clause.
> > >
> > >
> > > Yeah, I'm actually not convinced this is "nothing to do". We're currently SFINAEing away AFAICT, but the standard asks us to reject the code out right.
> >
> >
> > Since there's only one `std::forward_like` overload in the standard library (true for both standard wording and implementations), as long as one writes `std::forward_like`, it's not observable whether _Mandates_ is implemented in the same way as _Constraints_.
>
> Indeed, that's why I added tests to make sure the SFINAE acts as a mandates.
Can we instead refactor the code to not SFINAE away? I'd be much happier with that, since it avoids portability issues and `static_assert`s are generally less heavy than SFINAE.
https://github.com/llvm/llvm-project/pull/127318
More information about the libcxx-commits
mailing list