<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74070>74070</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
"Improve heuristic to determine whether to evaluate a static variable's initializer" broke compiling Qt Declarative
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang,
clang:codegen,
regression,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mstorsjo
</td>
</tr>
</table>
<pre>
The commit 53a24c33f09b81b8f009afbabd05f7086db3f288, broke compiling of Qt Declarative (observed with version 5.15), where compilation now fails with this error:
```
In file included from jit/qv4baselineassembler.cpp:45:
jit/qv4assemblercommon_p.h:253:42: error: integer value -1 is outside the valid range of values [0, 7] for the enumeration type 'RegisterID' [-Wenum-constexpr-conversion]
253 | static const RegisterID NoRegister = RegisterID(-1);
| ^
```
The surprising thing is that this error only pops up when compiling with debug info enabled - without debug info, it still compiles fine.
The issue can be reproduced with this attached file, [enum-range-preproc.zip](https://github.com/llvm/llvm-project/files/13526389/enum-range-preproc.zip), compiled with `clang -target i686-w64-mingw32 -c -g enum-range-preproc.cpp`. Without the `-g` parameter, it successfully compiles.
CC @Michael137 @shafik @AaronBallman
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlN-P4yYQx_8a8jKyhcG_8uCH7KaR7qGVWlW6xwrjsT17GFzA2e799RXeJLfXXh8aRYmBma-Hz3xBhUCTRexY9cSq80FtcXa-W0J0Pry4Q--Gt-73GUG7ZaEIlVSi1FKO_Ni3Rd-OnB_V2Kt-4NXY8LYeejmKtmXiGXrvvuyJKxmyE7gRfo1wRm2UV5GuCEy0rg_orzjAK8UZrugDOQtVXlRMHJPK64z-rqJiWrTuFUZFJrznxJkCoPfOM3li_Mz4idX89t2HnyyMZBDIarMNOMDo3QIvFJm4_HktexXQkEUVAi69QZ_rdWXyVFYPwUfsIybxcPaPNZ-ZPIlK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