File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ void swift::checkUnsafeStorage(NominalTypeDecl *nominal) {
443443
444444 // Look for any unsafe storage in this nominal type.
445445 SmallVector<UnsafeUse, 4 > unsafeUses;
446- UnsafeStorageVisitor (ctx, unsafeUses).visit (nominal, nominal-> getDeclContext () );
446+ UnsafeStorageVisitor (ctx, unsafeUses).visit (nominal, nominal);
447447
448448 // If we didn't find any unsafe storage, there's nothing to do.
449449 if (unsafeUses.empty ())
Original file line number Diff line number Diff line change @@ -191,3 +191,11 @@ class ClassWithUnsafeStorage {
191191 var int : Int = 0
192192 var array : [ UnsafeSuper ] ? = nil // expected-note{{property 'array' involves unsafe type 'UnsafeSuper'}}
193193}
194+
195+ // expected-warning@+3{{generic struct 'GenericStructWithUnsafeThings' has storage involving unsafe types}}
196+ // expected-note@+2{{add '@unsafe' if this type is also unsafe to use}}
197+ // expected-note@+1{{add '@safe' if this type encapsulates the unsafe storage in a safe interface}}
198+ struct GenericStructWithUnsafeThings < T> {
199+ var property : T
200+ var pointer : PointerType // expected-note{{property 'pointer' involves unsafe type 'PointerType'}}
201+ }
You can’t perform that action at this time.
0 commit comments