mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Methods that are marked as `const` in C++ can still modify a field of the object if the field is marked as `mutable`. We previously imported all methods of structs with mutable fields as mutating in Swift. Unfortunately this doesn't work well with libstdc++, which uses mutable fields for some commonly used container types. Our current user model assumes that we trust the `const` keyword on a C++ method, and import them as non-mutating in Swift. Let's make sure the tests reflect that.
11 lines
349 B
Swift
11 lines
349 B
Swift
// RUN: %target-swift-ide-test -print-module -module-to-print=MutableMembers -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
|
|
|
|
// CHECK: struct HasPublicMutableMember {
|
|
// CHECK: func foo() -> Int32
|
|
// CHECK: var a: Int32
|
|
// CHECK: }
|
|
|
|
// CHECK: struct HasPrivateMutableMember {
|
|
// CHECK: func bar()
|
|
// CHECK: }
|