mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 21:43:33 +00:00
Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the default definition would be ill-formed " (#21307)
Revert "Fix #13093 C++ Atomics: operator= is implicitly deleted because the default definition would be ill-formed (#21169)"
This reverts commit a7bae919ad.
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
discard """
|
||||
targets: "cpp"
|
||||
action: reject
|
||||
errormsg: "The PledgeObj type requires the following fields to be initialized: refCount"
|
||||
"""
|
||||
|
||||
import atomics
|
||||
|
||||
type
|
||||
Pledge* = object
|
||||
p: PledgePtr
|
||||
|
||||
PledgePtr = ptr PledgeObj
|
||||
PledgeObj = object
|
||||
refCount: Atomic[int32]
|
||||
|
||||
proc main() =
|
||||
var pledge: Pledge
|
||||
pledge.p = createShared(PledgeObj)
|
||||
let tmp = PledgeObj() # <---- not allowed: atomics are not copyable
|
||||
|
||||
pledge.p[] = tmp
|
||||
|
||||
main()
|
||||
@@ -1,20 +0,0 @@
|
||||
discard """
|
||||
targets: "cpp"
|
||||
action: "compile"
|
||||
"""
|
||||
|
||||
type
|
||||
String* {.importcpp: "std::string", header: "string".} = object
|
||||
|
||||
proc initString*(): String
|
||||
{.importcpp: "std::string()", header: "string".}
|
||||
|
||||
proc append*(this: var String, str: String): String
|
||||
# bug seems to trigger when `#`, `@`, or `$1` is used inside `importcpp`
|
||||
{.importcpp: "#.append(@)", header: "string", discardable.} # <- changed from `importcpp: "append"`
|
||||
|
||||
var
|
||||
s1 = initString()
|
||||
s2 = initString()
|
||||
|
||||
s1.append s2
|
||||
Reference in New Issue
Block a user