swift
cc8f0605 - [cxx-interop] Fix crash when importing C++ forward-declared template specializations in typedefs (#84186)

Commit
2 days ago
[cxx-interop] Fix crash when importing C++ forward-declared template specializations in typedefs (#84186) Swift crashes when importing C++ typedefs to forward-declared explicit template specializations. In assert build we see this assertion failure happening in clang: `Assertion failed: (!T->isDependentType() && "should not see dependent types here"), function getTypeInfoImpl, file TypeNodes.inc, line 79.` Example that crashes: ```cpp template <typename T> struct MyTemplate { T value; }; template <> struct MyTemplate<int>; // Forward-declared specialization typedef MyTemplate<int> MyIntTemplate; ``` In this patch, I propose detecting forward-declared explicit specializations in typedef imports. Instead of crashing, these specializations should be blocked from being imported with a diagnostic similar to the forward declared (but not defined) structs. rdar://147595723
Author
Parents
Loading