[libcxx-commits] [PATCH] D145376: [libc++] add declval failure assertion for instantiation

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 7 13:45:40 PST 2023


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

This change is not correct and cannot proceed.

It changes the meaning of this code:

  template <class T, class U, class = U[std::declval<T>()]>
  constexpr bool xxx(int) { return true; }
  
  template <class T, class U>
  constexpr bool xxx(long) { return false; }
  
  constexpr bool y = xxx<long long, int>(0);

declval has been constructed very carefully to performant, and correct in all the weird cases where Clang will try to eagerly instantiate something (Ex. when it tries to check for C++11 narrowing when evaluating constant expressions).
Please be cautious when modifying weird things like declval.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145376/new/

https://reviews.llvm.org/D145376



More information about the libcxx-commits mailing list