Value-dependence of requires-expressions
Section [temp.dep.constexpr]
Christof Meerwald

Created on 2023-07-17.00:00:00 last changed 3 weeks ago


Date: 2023-08-26.21:49:54

CWG 2023-08-25

The first change has consensus and is progressed via issue 2785; the second change should use an approach of recursive decomposition for requires-expression, similar to other paragraphs in [temp.dep.constexpr]. The implementation divergence is believed to be an independent bug in one implementation.

Date: 2023-07-18.19:26:28

Suggested resolution:

  1. Change in [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 )
  2. Insert a new paragraph before [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 ...

Date: 2023-07-17.00:00:00


   template<typename T>
   struct A
     static_assert(sizeof(T) == 3);    // #1

   template<bool B>
   struct C
     static_assert(B);                 // #2

   template<typename T, typename U>
   int f(typename C<requires { typename T::type; }>::type, typename A<T>::type, U);

   int i = f<char>(0, 1, 2);

Is the requires-expression value-dependent after substituting the explicit template argument, thus failing at #2 instead of at #1?

Date User Action Args
2023-08-26 21:49:54adminsetmessages: + msg7406
2023-07-18 19:26:28adminsetmessages: + msg7386
2023-07-17 00:00:00admincreate