This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


2806. Make a type-requirement a type-only context

Section: 13.8.1  [temp.res.general]     Status: DRWP     Submitter: Barry Revzin     Date: 2023-10-10

[Accepted as a DR at the November, 2023 meeting.]

Consider:

  template <typename T>
  concept C = requires {
    typename T::type<void>;   // template required?
  };

There is implementation divergence: gcc accepts, clang and MSVC reject.

A type-requirement ought to be a type-only context.

Proposed resolution (approved by CWG 2023-10-20):

  1. Change in 7.5.8.3 [expr.prim.req.type] paragraph 1 as follows:

    A type-requirement asserts the validity of a type. The component names of a type-requirement are those of its nested-name-specifier (if any) and type-name. [Note 1: The enclosing requires-expression will evaluate to false if substitution of template arguments fails. —end note]
  2. Change in 13.8.1 [temp.res.general] paragraph 4 as follows:

    A qualified or unqualified name is said to be in a type-only context if it is the terminal name of
    • a typename-specifier, type-requirement, nested-name-specifier, elaborated-type-specifier, class-or-decltype, or
    • ...