Title
Clarify point of reference for source_location::current() (DE 169)
Status
c++20
Section
[support.srcloc.cons]
Submitter
Jens Maurer

Created on 2020-02-13.00:00:00 last changed 38 months ago

Messages

Date: 2020-02-14.06:55:06

Proposed resolution:

This wording is relative to N4849.

  1. Modify [support.srcloc.cons] as indicated:

    static consteval source_location current() noexcept;
    

    -1- […]

    -2- Remarks: When a default member initializer is used to initialize a non-static data member, any calls to currentAny call to current that appears as a default member initializer ([class.mem]), or as a subexpression thereof, should correspond to the location of the constructor definition or aggregate initialization that initializes the memberuses the default member initializer. Any call to current that appears as a default argument ([dcl.fct.default]), or as a subexpression thereof, should correspond to the location of the invocation of the function that uses the default argument ([expr.call]).

    -3- [Note: When used as a default argument ([dcl.fct.default]), the value of the source_location will be the location of the call to current at the call site. — end note]

Date: 2020-02-14.06:55:06

[ 2020-02 Moved to Immediate on Thursday afternoon in Prague. ]

Date: 2020-02-13.00:00:00

Addresses DE 169

The expectation of the note that a default argument expression involving current() causes a source_location to be constructed that refers to the site of a function call where that default argument is needed has no basis in normative text. In particular, 9.2.3.6 paragraph 5 seems to imply that the name "current" and its semantics are bound where it appears lexically in the function declaration.

Proposed change:

Add normative text to express the desired semantics.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-14 06:55:06adminsetmessages: + msg11094
2020-02-14 06:55:06adminsetstatus: new -> immediate
2020-02-13 10:21:24adminsetmessages: + msg11050
2020-02-13 00:00:00admincreate