Title
Effect of requirement-parameter-lists on odr-usability
Status
ready
Section
6.3 [basic.def.odr]
Submitter
Hubert Tong

Created on 2024-06-24.00:00:00 last changed yesterday

Messages

Date: 2024-11-19.09:41:41

Proposed resolution (approved by CWG 2024-10-11):

Change in 6.3 [basic.def.odr] bullet 10.2.2 as follows:

A local entity (6.1 [basic.pre]) is odr-usable in a scope (6.4.1 [basic.scope.scope]) if:
  • ...
  • for each intervening scope (6.4.1 [basic.scope.scope]) between the point at which the entity is introduced and the scope (where *this is considered to be introduced within the innermost enclosing class or non-lambda function definition scope), either:
    • the intervening scope is a block scope, or
    • the intervening scope is the function parameter scope of a lambda-expression or requires-expression, or
    • the intervening scope is the lambda scope of a lambda-expression that has a simple-capture naming the entity or has a capture-default, and the block scope of the lambda-expression is also an intervening scope.
Date: 2024-06-24.00:00:00

(From submission #561.)

Consider:

  bool f() {
    constexpr int z = 42;
    return requires {
      sizeof(int [*&z]);
    } && requires (int x) {
      sizeof(int [*&z]);
    };
  }

The second requires-expression introduces a function parameter scope according to 6.4.4 [basic.scope.param]. This affects odr-usability as specified in 6.3 [basic.def.odr] paragraph 10, but the two requires-expression in the example ought to actually behave the same.

History
Date User Action Args
2024-11-19 12:01:24adminsetstatus: tentatively ready -> ready
2024-10-11 20:31:34adminsetstatus: open -> tentatively ready
2024-06-26 00:17:14adminsetmessages: + msg7751
2024-06-24 00:00:00admincreate