File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -4102,6 +4102,15 @@ namespace {
4102
4102
if (ctordecl->isCopyConstructor () || ctordecl->isMoveConstructor ())
4103
4103
return nullptr ;
4104
4104
4105
+ // Don't import the generic ctors of std::span, rely on the ctors that
4106
+ // we instantiate when conforming to the overlay. These generic ctors
4107
+ // can cause crashes in codegen.
4108
+ // FIXME: figure out why.
4109
+ const auto *parent = ctordecl->getParent ();
4110
+ if (funcTemplate && parent->isInStdNamespace () &&
4111
+ parent->getIdentifier () && parent->getName () == " span" )
4112
+ return nullptr ;
4113
+
4105
4114
DeclName ctorName (Impl.SwiftContext , DeclBaseName::createConstructor (),
4106
4115
bodyParams);
4107
4116
result = Impl.createDeclWithClangNode <ConstructorDecl>(
Original file line number Diff line number Diff line change @@ -11,3 +11,11 @@ arr.withUnsafeBufferPointer { ubpointer in
11
11
let _ = ConstSpanOfInt ( ubpointer. baseAddress!, ubpointer. count)
12
12
// expected-warning@-1 {{'init(_:_:)' is deprecated: use 'init(_:)' instead.}}
13
13
}
14
+
15
+ arr. withUnsafeBufferPointer { ubpointer in
16
+ // FIXME: this crashes the compiler once we import span's templated ctors as Swift generics.
17
+ let _ = ConstSpanOfInt ( ubpointer. baseAddress, ubpointer. count)
18
+ // expected-error@-1 {{value of optional type 'UnsafePointer<Int32>?' must be unwrapped to a value of type 'UnsafePointer<Int32>'}}
19
+ // expected-note@-2 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
20
+ // expected-note@-3 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
21
+ }
You can’t perform that action at this time.
0 commit comments