<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102937>102937</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Unstable output with AllowShortFunctionsOnASingleLine=inline
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vient
</td>
</tr>
</table>
<pre>
Somewhat minified test case:
```cpp
auto f() {
#define M(x) \
case x: { \
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.
Output 1:
```cpp
auto f() {
#define M(x) \
case x: { \
return { \
#x \
}; \
}
}
```
Output 2:
```cpp
auto f() {
#define M(x) \
case x: { \
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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE2PmzAQ_TXmMiICm8Rw4JBsFGmlVntYVT0bmIC7jo3sYbP77ytD0u5HV3to1SgCM-Nnv_F7HhWC7i1izdY7tt4naqLB-fpRo6Wkcd1zfe9OeB4UwUlbfdTYAWEgaFVAJrYs27NsyzbZ8m_HcYmoiRwcGS8Zr4DJ3WUeFx0etUX4ynj5FHPxx9Y3Sx7mZeGJiW0EwdssgEeavJ1X5OKJyT0Tu5czYmTZ6tfgym35PDh_UkTa9qAJzpoGiLyNsn16nHNpXkL6Hb13HtI00LNBJvaMSyZ3W2Pc-X5wng6TbUk7G-7s9l7b3uAXbeOJwK01cSRnyCYDj2EyFEBbcKHVxqh5dzfROFGAFJzXvbbKQOs6hNG7bmoxXCZAzvhNpPo2zmP8POh2-DNE2Q6CA2dXS-F319w_EO1DwT7Q6nUcIGr3OvZOyU-FvLsew_-p56-NtzxvCXQABR57jyFoZ6Mv3tgvypdLODv_ECAyXcFtCBNGaCBtDIweA1p6j60ittMdWEfQDtg-LB4nP9mHVdLVoqtEpRKsc8lFUXKeF8lQl1VZNDKXpciaTYvrJltnWaWaThUCZScTXfOMF1mZ81xmQhQrVW5k21Qo1jznXOWsyPCktFkZ83haOd8nOlKu84xXQiZGNWjC3GU4f0mZcR77jq8jLm2mPrAiMzpQ-L0SaTJzh3oFXO_hmw2kGoNX48-lfn5H93q-osnkTT0QjSF6iB8YP_SahqlZte7E-CHuf3mlo3c_sCXGD3NZgfHDpbLHmv8MAAD__3RuiGY">