[libcxx-commits] [libcxx] [libc++] Verifies std::forward_like's mandates clause. (PR #127318)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 27 09:48:13 PST 2025


mordante 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.
 
> It's not very clear to me what should happen when user-provided overloads are involved...

AFAIK they are not allowed to do that.


https://github.com/llvm/llvm-project/pull/127318


More information about the libcxx-commits mailing list