Title
__func__ should be constexpr
Status
extension
Section
9.5.1 [dcl.fct.def.general]
Submitter
Anthony Polukhin

Created on 2017-10-23.00:00:00 last changed 9 months ago

Messages

Date: 2018-11-15.00:00:00

Rationale (November, 2018):

See also issue 1962, which asks that the type of __func__ be const char*. These two goals are incompatible, so EWG input is requested.

Date: 2018-10-15.00:00:00

Notes from the October, 2018 teleconference:

CWG agreed with the proposed change.

Date: 2017-10-23.00:00:00

The definition of __func__ in 9.5.1 [dcl.fct.def.general] paragraph 8 is:

  static const char __func__[] = "function-name";

This prohibits its use in constant expressions, e.g.,

  int main () {
    // error: the value of __func__ is not usable in a constant expression
    constexpr char c = __func__[0];
  }
History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6321
2020-12-15 00:00:00adminsetmessages: + msg6320
2020-12-15 00:00:00adminsetstatus: open -> extension
2017-10-23 00:00:00admincreate