Skip to content

Commit ce932b2

Browse files
authored
Merge pull request #34557 from zoecarver/cxx/fix/is-dependent-type-over-aligned
2 parents 5c59bab + 7f2b0aa commit ce932b2

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,6 +3255,10 @@ namespace {
32553255
return nullptr;
32563256
}
32573257

3258+
// TODO(SR-13809): fix this once we support dependent types.
3259+
if (decl->getTypeForDecl()->isDependentType())
3260+
return nullptr;
3261+
32583262
// Don't import nominal types that are over-aligned.
32593263
if (Impl.isOverAligned(decl))
32603264
return nullptr;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Make sure that we can import a type that uses a "dependent type" after being
2+
// specialized (i.e. "size_type" in "Lander").
3+
template <class T> struct Lander;
4+
5+
template <>
6+
struct Lander<void> {};
7+
8+
template <class T> struct Lander {
9+
typedef unsigned long size_type;
10+
// Make sure we don't crash here. Before being specialized, "size_type" is
11+
// technically a depedent type because it expands to "Lander<T>::size_type".
12+
void test(size_type) { }
13+
};
14+
15+
using Surveyor = Lander<char>;

test/Interop/Cxx/templates/Inputs/module.modulemap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ module ClassTemplateNonTypeParameter {
5353
module ClassTemplateTemplateParameter {
5454
header "class-template-template-parameter.h"
5555
}
56+
57+
module ClassTemplateWithTypedef {
58+
header "class-template-with-typedef.h"
59+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=ClassTemplateWithTypedef -I %S/Inputs -source-filename=x -enable-cxx-interop | %FileCheck %s
2+
3+
// CHECK: struct __CxxTemplateInst6LanderIcE {
4+
// CHECK: typealias size_type = UInt
5+
// CHECK: init()
6+
// CHECK: mutating func test(_: UInt)
7+
// CHECK: }
8+
// CHECK: typealias Surveyor = __CxxTemplateInst6LanderIcE

0 commit comments

Comments
 (0)