Skip to content

Commit

Permalink
Revert "Fix nim-lang#13093 C++ Atomics: operator= is implicitly delet…
Browse files Browse the repository at this point in the history
…ed because the default definition would be ill-formed " (nim-lang#21307)

Revert "Fix nim-lang#13093 C++ Atomics: operator= is implicitly deleted because the default definition would be ill-formed  (nim-lang#21169)"

This reverts commit a7bae91.
  • Loading branch information
ringabout authored and bung87 committed Jul 29, 2023
1 parent b881402 commit 7be6c31
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 54 deletions.
4 changes: 0 additions & 4 deletions compiler/cgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,6 @@ proc constructLoc(p: BProc, loc: var TLoc, isTemp = false) =
nilLoc.r = rope("NIM_NIL")
genRefAssign(p, loc, nilLoc)
else:
if typ.kind == tyVar:
let tt = typ.skipTypes({tyVar})
if isImportedType(tt) and tfRequiresInit in tt.flags:
return
linefmt(p, cpsStmts, "$1 = ($2)0;$n", [rdLoc(loc),
getTypeDesc(p.module, typ, mapTypeChooser(loc))])
else:
Expand Down
6 changes: 1 addition & 5 deletions compiler/semstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
tyUserTypeClassInst})
if actualType.kind in {tyObject, tyDistinct} and
actualType.requiresInit:
# imported type use requiresInit pragma prevent implicit initialization
if (tfRequiresInit in actualType.flags and sfImportc in actualType.sym.flags):
discard
else:
defaultConstructionError(c, v.typ, v.info)
defaultConstructionError(c, v.typ, v.info)
else:
checkNilable(c, v)
# allow let to not be initialised if imported from C:
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/concurrency/atomics.nim
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ when defined(cpp) or defined(nimdoc):
## with other moSequentiallyConsistent operations.

type
Atomic*[T] {.importcpp: "std::atomic", completeStruct, requiresInit.} = object
Atomic*[T] {.importcpp: "std::atomic", completeStruct.} = object
## An atomic object with underlying type `T`.
raw: T

Expand Down
24 changes: 0 additions & 24 deletions tests/cpp/t13093.nim

This file was deleted.

20 changes: 0 additions & 20 deletions tests/cpp/t17982.nim

This file was deleted.

0 comments on commit 7be6c31

Please sign in to comment.