Skip to content

Spurious reference to function literals in 'constant context' #3619

@eernstg

Description

@eernstg

Thanks to @sgrekhov for noticing this!

The definition of what it means to be in a constant context includes a case involving a function literal, here.

However, the situation which is described there can never occur: It is always a compile-time error for a function literal to occur in a constant context, because a function literal is never a constant expression.

This part of the rule is only relevant if we introduce a notion of constant function literals (see #1048 for a proposal ... from 2012 ... with about 250 supporting emojis).

We may wish to eliminate this part of the 'constant context' rule (or we may wish to add constant function literals). In any case, the current situation is somewhat confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhanced-constRequests or proposals about enhanced constant expressionsspecification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions