mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Failing to do so lead the codegen to emit invalid code sometimes, especially when C++ references were involved. Fixes #10241
20 lines
381 B
Nim
20 lines
381 B
Nim
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): var String
|
|
{.importcpp: "append", header: "string", discardable.}
|
|
|
|
var
|
|
s1 = initString()
|
|
s2 = initString()
|
|
|
|
s1.append s2
|