Skip to content

clang-format breaks C++ User-defined literal _$ #61612

@duduarbel

Description

@duduarbel

Applying Clang-Format on the following code:

int operator"" _€(unsigned long long  amount) { return amount; }
int operator"" _$(unsigned long long  amount) { return amount; }


int main()
{
    auto euros = 1_€ ;
    auto dollars = 2_$;
    
    return 0;
}

works well for the euros, but adds an extra space between the _ and the $ - which causes the compilation to fail;

    auto euros = 1_€ ; // Ok
    auto dollars = 2_ $; // compilation fails

Metadata

Metadata

Assignees

Labels

clang-formatinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compiles

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions