Open aganea opened 8 months ago
I don't quite understand why we're calling StripImplicitInstantiation()
in SemaTemplate.cpp
from CheckSpecializationInstantiationRedecl()
. I'm seeing PrevTSK = TSK_ImplicitInstantiation
but clearly in the example above it isn't an implicit instantiation.
This seem to work pre-C++20 because of -fdelayed-template-parsing
CC @AaronBallman
@llvm/issue-subscribers-c-20
Author: Alexandre Ganea (aganea)
CC @erichkeane as well
I can confirm the behavior: https://godbolt.org/z/EYh8aY3Gq
C++20: define dso_local noundef zeroext i1 @"??$foo@$0A@@A@@SA_NXZ"() align 2
Otherwise: define dso_local dllexport noundef zeroext i1 @"??$foo@$0A@@A@@SA_NXZ"() align 2
When building with
clang-cl.exe
, the following wouldn't exportfoo<0>
. This works with MSVCcl.exe
.No symbols are exported:
Removing
/std:c++20
from the cmd-line would properly export the specializationfoo<0>
:Declaring the specialization in the struct would export the specialization as well:
Moving the specialization before
b()
works too:Also if
main()
doesn't callb()
the specialization would be exported as well:+@zmodem Since you've worked in this area in the past.