CWG Issue 2774 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
2774. Value-dependence of _requires-expression_s
Section: 13.8.3.4 [temp.dep.constexpr]Status: openSubmitter: Christof MeerwaldDate: 2023-07-17
Consider:
template struct A { static_assert(sizeof(T) == 3); // #1 };
template struct C { static_assert(B); // #2 };
template<typename T, typename U> int f(typename C<requires { typename T::type; }>::type, typename A::type, U);
int i = f(0, 1, 2);
Is the requires-expression value-dependent after substituting the explicit template argument, thus failing at #2 instead of at #1?
Suggested resolution:
- Change in 13.8.3.3 [temp.dep.expr] paragraph 4 as follows:
Expressions of the following forms are never type-dependent (because the type of the expression cannot be dependent):
...
noexcept ( expression )
requires-expression - Insert a new paragraph before 13.8.3.4 [temp.dep.constexpr] paragraph 5:
A requires-expression is value-dependent if it depends on a template parameter.
An expression of the form &qualified-id where the qualified-id names a dependent member ...
CWG 2023-08-25
The first change has consensus and is progressed viaissue 2785; the second change should use an approach of recursive decomposition for requires-expression, similar to other paragraphs in 13.8.3.4 [temp.dep.constexpr]. The implementation divergence is believed to be an independent bug in one implementation.