Skip to content

Commit 25bcd26

Browse files
committed
[interop] verify that a C++ record is a Swift nominal type before trying to add explicit protocol conformances
This fixes the issue where we crashed printing foundation
1 parent 700eb93 commit 25bcd26

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,8 @@ namespace {
25882588
conformToCxxSequenceIfNeeded(Impl, nominalDecl, decl);
25892589
}
25902590

2591-
addExplicitProtocolConformances(cast<NominalTypeDecl>(result));
2591+
if (auto *ntd = dyn_cast<NominalTypeDecl>(result))
2592+
addExplicitProtocolConformances(ntd);
25922593

25932594
return result;
25942595
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=Foundation -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop
2+
3+
// REQUIRES: OS=macosx

0 commit comments

Comments
 (0)