<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62608>62608</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format CompactNamespaces not honored when ColumnLimit is 0
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohnC32
</td>
</tr>
</table>
<pre>
Given
```c++
namespace foo {
namespace bar {
int a;
}
}
```
using this `_clang-format` format with clang-format 16,
```yaml
---
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
CompactNamespaces: true
...
```
We get the expected result:
```c++
namespace foo { namespace bar {
int a;
}} // namespace foo::bar
```
However, if we use this `_clang-format` format with ColumnLimit set to 0,
```yaml
---
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 0
CompactNamespaces: true
...
```
we get:
```c++
namespace foo {
namespace bar {
int a;
}
} // namespace foo::bar
```
Notice, the `CompactNamespaces: true` is not honored when we have `ColumnLimit: 0`.
The help for ColumnLimit says *"A column limit of 0 means that there is no column limit. In this
case, clang-format will respect the input’s line breaking decisions within statements unless they
contradict other rules."* Thus, the help indicates that CompactNamespaces should be honored, but it
isn't.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU2P2zYQ_TXUZWCBpj7WPujgXddpiiI9NECOBUWORbYUaYijdf3vC0oyYmfbYGEUAQSbnjH55r03Q8kYbecRG1Y9s2qfyZFMGJpfgvEvhcjaoC_NB_uKnvE947vls-bzo5h4Ts8U9bLHeJIK4RgCsKc34VYOX8PWE0hWLL_Y0_7bxRXjFniM1ndAxkZgNf9DOem71TEMvSRWc5hXcLZk4DYH65qJl39lcJG9m0Or1WpePMuI-jf_O10csmIHH0LoHM65j16jpy9Wk0mpco6-BDf2_lfbW0rRNefXeH-Sij5dFYgpS8O4HJbn-Xe4fkHokIAMAv59QkWoYcA4uoTxgBvwbiOe9gBMHJg4wN0pCbfYtXL4TtU_hzO-4sDEC9gjnBHGiO8z7EZEiIl4AP4jXfs_PDtPnj3mz4PT8rhVnwJZhcmp1GOs5v9NveZgI_hAYIIPA2o4G_TJXiNfl73fiFnz_Bbss0Ew6E7J8nur5SUCEzsmxA7UlAA3ZcIROPQofQQycpqEAec67v6Yw0c_tdiMpGScSN1dAGfrXJqeNEcTXetPI7GfBNtwtt1GcNYjtAPKv9INo1HZaIOPU2taD5EkYY-eIozeYUwl4WUBDJ4Gqa0iCKlGGEaHMWdCMLED-GzGeBV5UsB6bZUkXGi9UR2iCaPT0OJV7bS9HQksLd0QPRNPtAic6abQ22IrM2zW9aaoar5e88w0rRZCi7Xg6qgFr9pKqbJa81JX6tjqY5XZRnBR8Ipv1lVR8W0uhTyW7WaDaoNlWZes5NhL63LnXvs8DF1mYxyxqUXNN5mTLbo4vTmE8HiGKZl4V_tsaNKeVTt2kZXc2Ujx6ylkyWFz59BbGd60223b2Ag8GwfXGKJTatR5CjpLZmxzFXomDglu-VqdhvAnKmLiMBUZmThMJP4JAAD__ylUGtg">