Title
Type of __func__
Status
open
Section
9.5.1 [dcl.fct.def.general]
Submitter
Steve Clamage

Created on 2014-07-04.00:00:00 last changed 24 months ago

Messages

Date: 2018-11-15.00:00:00

Rationale (November, 2018):

See also issue 2362, which asks for the ability to use __func__ in a constexpr function. These two goals are incompatible, so EWG input is requested.

EWG 2022-11-11

Paper requested. This is tracked in github issue cplusplus/papers#1375.

Date: 2015-05-15.00:00:00

Notes from the May, 2015 meeting:

CWG agreed with the suggested direction.

Date: 2014-07-04.00:00:00

Two questions have arisen regarding the treatment of the type of the __func__ built-in variable. First, some implementations accept

  void f() {
    typedef decltype(__func__) T;
    T x = __func__;
  }

even though T is specified to be an array type.

In a related question, it was noted that __func__ is implicitly required to be unique in each function, and that not only the value but the type of __func__ are implementation-defined; e.g., in something like

  inline auto f() { return &__func__; }

the function type is implementation-specific. These concerns could be addressed by making the value a prvalue of type const char* instead of an array lvalue.

History
Date User Action Args
2022-11-25 06:39:38adminsetstatus: extension -> open
2020-12-15 00:00:00adminsetmessages: + msg6319
2020-12-15 00:00:00adminsetstatus: drafting -> extension
2015-05-25 00:00:00adminsetmessages: + msg5506
2015-05-25 00:00:00adminsetstatus: open -> drafting
2014-07-04 00:00:00admincreate