Skip to content

Commit 906aedb

Browse files
[Cygwin] Internal class in explicitly-instantiation-declarated template should be instantiated
In-code comment says "explicit instantiation decl of the outer class doesn't affect the inner class" but this behavior seems MSVC specific, mingw-gcc and cygwin-gcc does not. Clang should honor gcc's behavior. This change fixes std::string compatibilty and resolves strange link error (statically linked), strange crash (dynamically linked) using libstdc++ on Cygwin. HACK! only change behavior for Cygwin, not MinGW, because linking to libc++ relies on the old behavior, even though it differs from GCC. Co-authored-by: Jeremy Drake <[email protected]>
1 parent c3a4a1f commit 906aedb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,6 +4361,7 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
43614361
continue;
43624362

43634363
if (Context.getTargetInfo().getTriple().isOSWindows() &&
4364+
!Context.getTargetInfo().getTriple().isWindowsCygwinEnvironment() &&
43644365
TSK == TSK_ExplicitInstantiationDeclaration) {
43654366
// On Windows, explicit instantiation decl of the outer class doesn't
43664367
// affect the inner class. Typically extern template declarations are

0 commit comments

Comments
 (0)