Skip to content

CWG2362 __func__ should be constexpr #1378

Description

@jfbastien

Migrating from https://isocpp.org/files/papers/P1018R18.html#issues
CWG2362

Section: 9.5.1 [dcl.fct.def.general] Status: extension Submitter: Anthony Polukhin Date: 2017-10-23
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];
  }

Notes from the October, 2018 teleconference:

CWG agreed with the proposed change.

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.

Meeting: handle with 1962.

Activity

  1. added this to the 2023-telecon milestone on Jan 25, 2023
  2. removed this from the 2023-telecon milestone on Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EWGEvolutionneeds-revisionPaper needs changes before it can proceed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions