Closed
Description
Somewhat minified test case:
void f() {
#define M(x) \
case 0: { \
return {#x}; \
}
}
Formatting it with clang-format-18 -Werror --style='{AllowShortFunctionsOnASingleLine: Inline}'
results in oscillating outputs - original code produces output 1, it produces output 2, which produces output 1, and so on (1️⃣🔄2️⃣).
Output 1:
void f() {
#define M(x) \
case 0: { \
return { \
#x \
}; \
}
}
Output 2:
void f() {
#define M(x) \
case 0: { \
return {#x}; \
}
}
It is a regression in clang-format-18, 17 works fine. Issue is still present in clang-format-19, did not check with trunk.