// RUN: %clang_cc1 -std=c++2c -fexperimental-new-constant-interpreter -verify=expected,both %s // RUN: %clang_cc1 -std=c++2c -verify=ref,both %s // both-no-diagnostics template struct integral_constant { static const _Tp value = __v; }; template using _BoolConstant = integral_constant; namespace std { template using _IsSame = _BoolConstant<__is_same(_Tp, _Up)>; template concept __same_as_impl = _IsSame<_Tp, _Up>::value; template concept same_as = __same_as_impl<_Up, _Tp>; template _Tp forward; template struct __invoke_result_impl { using type = decltype(__builtin_invoke(_Args()...)); }; template using __invoke_result = __invoke_result_impl; template using __invoke_result_t = __invoke_result<_Args...>::type; template constexpr __invoke_result_t<_Args...> __invoke(_Args... __args) { return __builtin_invoke(__args...); } template using invoke_result_t = __invoke_result_t<_Fn, _Args...>; template constexpr invoke_result_t<_Fn, _Args...> invoke(_Fn __f, _Args... __args) { return __invoke(__f, __args...); } template struct __cw_fixed_value { constexpr __cw_fixed_value(_Tp) : __data() {} _Tp __data; }; template <__cw_fixed_value> struct constant_wrapper; template <__cw_fixed_value _Xp> auto cw = constant_wrapper<_Xp>{}; template concept __constexpr_callable = requires { typename constant_wrapper; }; template <__cw_fixed_value _Xp> struct constant_wrapper { static constexpr auto &value = _Xp.__data; void operator()(...); template requires(!__constexpr_callable) auto operator()(_Args...) noexcept(invoke(value, forward<_Args>...)) {} }; } // namespace std template struct MustBeInt { static_assert(std::same_as); }; struct Poison { template constexpr auto operator()(T) -> MustBeInt { return {}; } }; bool test() { using T = std::constant_wrapper; T()(std::cw<5>); return true; }