<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62964>62964</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang++ consumes many gigabytes of memory and hangs for many minutes on simple input
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sfc-gh-bhannel
</td>
</tr>
</table>
<pre>
The program, as small as I could reduce it:
```
class A {};
enum Enum { C_Enum_t = 0 };
void test() {
auto dump = [](const auto& a, Enum) {
a << a;
return a;
};
dump(A(), D_Enum_t) == dump(A(), D_Enum_t);
}
```
The program is not correct C++, but it still shouldn't cause the compiler to eat all the memory on the system.
Information about my clang version:
```
clang version 16.0.0
Target: aarch64-unknown-linux-gnu
Thread model: posix
```
I was able to reproduce it on godbolt.org, so it's not specific to my system:
https://godbolt.org/z/6MM7ffneq
clang produces a bit of error output, then hangs and consumes memory. I observed it eat 27gb and then grind my system to a halt as it started to swap to disk.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE2PozgQ_TXOpRRETIDkwKGTbKQ-zG3vo8JUwDvGZl1292R__coOM52dbY2EANv18d6rB8isR0vUifok6ssGY5ic7_imtuO07Se0lsymd8O9-3MiWLwbPc5CngEZeEZj0ssrKBfNAJ6GqAh0ENWLKC-ifBFNuV55qQwywwuI9iTai6hOa1S-k40z_JFuoj3B-Wt6_RpAVBco4f_hb04PEIiDkAchj7lmPgDAGBwMcV5y8oOakAflLId8KGQDmFikHr8kAyCI6iyqM-DPluApRG-fdz6BBLmpkIeXB6bU4bLyyF2qSwL026CPku3lUw2f5gCawboAynlPKsBZyFO-ztDHADoAB20M8JTGY4VsAyiMTBAmAuXmRRvyEBwQBkjDTPszzc7fwdm84jsHmotnmq_25vyMQTsL2LsYYL6DMmhHeCPP2tnfzP8jCHZNURY_WKEfKfkGEL2amv022m_Wvdut0TZ-3442_qDvCQeY3UAmhS-O9fdPm61g4R0ZsDeUeHpavFtNmhiObuidCYXzY1KNXTKvbB-y8kJK37RKifN9VeIntSmEhdNKXoW8_qfQ9R8hr82XL-3tZunvZzQPAVYMDAh9wnED8t55cDEsMSQgYSILE9qRAe0AyblxJl5nU8AruJ7Jv9GQiKTpyXbsc2xOHb22wwfoxABhQhPS55p9gT7QkPb5HZf0HDR_KzZDVw3H6ogb6nbNod7tq0aWm6lr-x0d25qGXXPcKVVif2zqpi5Vc0Op9nKjO1nKqqxlIyvZlmVRH5oBa6r3ig59XZZiX9KM2hTGvM1Jp41mjtQ18tjsNwZ7Mpx_Q1Jaeod8KKRMfyXfpZxtH0cW-9JoDvxRJehgqMvCPuz_pBbaO4x6xP4eiJPOq7eTTg91b84_wmZtYw6ywHpeDIG2Swyb6E33y6h1mGJfKDcLeU0w1sd28e4vUkHIawbPyQSJ3L8BAAD__5M7qVc">