Skip to content

The tail "\" is added in the C++ code #166911

@QI1002

Description

@QI1002

Hi

I have the C++ code like below: (Two "//" in the same column)

#include <stdio.h>
int main(void) {
#if TEMP
    for (size_t index = 0; index < 10; ++index) {
        printf("hello world");
    }
#endif  // TEMP
        //
    return 0;
}

After running clang-format, it will output the extra "\" char in the end of line of the first "//"

#endif  // TEMP \

It will cause the compiler error if I build them by the command "gcc -Werror=comment test.cc".
I found the issue occur in llvm 21.1.0 or 17.00.
Do you have some options to avoid it before the fix ?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-formatinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compilesquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions