Should consteval constructor produce symbols? (original) (raw)
(From #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)