Skip to content

Commit 31b1ebf

Browse files
authored
Merge pull request swiftlang#10469 from jckarter/c-pointer-to-nested-function-in-generic
SILGen: Remove assertion that rejected context-free nested functions in generic contexts when referenced as C function pointers.
2 parents 638cded + 141a0b0 commit 31b1ebf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,6 @@ ManagedValue emitCFunctionPointer(SILGenFunction &gen,
14831483
// in the metatype.
14841484
assert(!declRef.getDecl()->getDeclContext()->isTypeContext()
14851485
&& "c pointers to static methods not implemented");
1486-
assert(declRef.getSubstitutions().empty()
1487-
&& "c pointers to generics not implemented");
14881486
loc = declRef.getDecl();
14891487
};
14901488

test/SILGen/c_function_pointers.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ struct StructWithInitializers {
6363
init(a: ()) {}
6464
init(b: ()) {}
6565
}
66+
67+
func pointers_to_nested_local_functions_in_generics<T>(x: T) -> Int{
68+
func foo(y: Int) -> Int { return y }
69+
70+
return calls(foo, 0)
71+
}

0 commit comments

Comments
 (0)