Skip to content

[BUG] constexpr anonymous object rejected as function or type #787

Closed
@JohelEGP

Description

@JohelEGP

Title: constexpr anonymous object rejected as function or type.

Minimal reproducer (https://cpp2.godbolt.org/z/9d7f8v8Pa):

main: () = {
  _: int == 0;
}
Commands:
cppfront main.cpp2
clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -I . main.cpp

Expected result: A better error message, or a valid program.

Actual result and error: main.cpp2(2,3): error: '_' (wildcard) may not be the name of a function or type - it may only be used as the name of an anonymous object or anonymous namespace

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions