<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82154>82154</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Should consteval constructor produce symbols?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++20,
consteval
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChuanqiXu9
</td>
</tr>
</table>
<pre>
(From https://github.com/llvm/llvm-project/issues/81745)
During the debugging process, I found the codegen will generate consteval constructor. It is surprising to me. In my memory, we shouldn't emit consteval functions at all.
Reproducer:
```
// test-main.cc
struct S1 { consteval S1(int) {} };
int main() {
struct S2 { S1 s = 0; };
S2 s;
}
```
```
$ clang++ -std=c++20 test-main.cc -c -o main.o
$nm -C main.o | grep S1
0000000000000000 W S1::S1(int)
```
We can double check the LLVM IR:
```
$ clang++ -std=c++20 test-main.cc -fmodule-file=M=test.pcm -S -emit-llvm -o -
```
We should be able to see the definition of `@_ZN2S1C2Ei`. And we can demangle it by:
```
$ llvm-cxxfilt _ZN2S1C2Ei
S1::S1(int)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVN-PozYQ_muGlxHIGAjkgYckNNJKd324SL2qLxWYgbg1duofd5f_vjLsbnPV6lZVowjwzPjz941npndOzpqoheoIVZf0wV-NbU_X0Ou_5K9hnwxmvLfAm7M1C169vzkoDsDPwM-z9NcwZMIswM9KfXl5pTdr_iDhgZ-lc4Ec8HOT12UFfA-sA3bYnl2wUs_or4QjDWGe4-pmjSDngJ_wCScT9LgGCDPSTBq_SqVwJk2299Gqnacvvdq-bBDe2AyfPEqHLtiblW49wuBCGT5pXO640GLsPR7wldBdTVCjBl57pEX6B8gpaOGl0Q57j71S2SP3T3SzZgyCbEzHgwN27Pm_LddMoSfn06WXOhNic2xs8ZIj1MeHUy858EZqD3wfPVB3CHUHxXHbJrXHiAO8eYlY7YiIL5B8hbzk6BCKDhkUx-8wYoR7XUXPm8zfllOiUL2egR-BHzF1foSiE9uSs--EYiowNSvdzLzu1wump2cjQn3C2dItyl4D2L9--Dm6igMUh4fM_IDwZ0LRaxxNGBShuJL4cy2gDx9--YhPn967rf8kb1rMGBSlk1QERfcRii4GZDexYHrBNBZUGjsipiH9MemtEHEg7CNxb9ARPffGJLWMlYhmwrizZL__9jO_5Cf-k4Qdy_Cgx1jMq3Baej0rQukRh_v7eteOFd--TVJ5fMBdA97PfTK2xbgv9n1CbV6zhpd5vauSa7ufhBircurLfqCyLgfWFIyqXb5rxmoo6kS2nPGS8bxhdbFjVUa7qq7GoRKCMVFOA5SMll6qLFLMjJ2TdZy0Dc-rMlH9QMqtg4vz1xsCzoGfouWlo6Kl6hLbrkKHMDsomZLOu39wvfSK2st2BW8OFXxud3T3ZTDKQXFOglXt_5iIUcXfAQAA__-d-pjr">