forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix nim-lang#19342; Imo nrvo shouldn't touch importc procs
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
struct Node | ||
{ | ||
int data[25]; | ||
}; | ||
|
||
|
||
struct Node hello(int name) { | ||
struct Node x = {999, 1, 2, 3, 4, 5, 6, 7, 8, 9, | ||
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, | ||
1, 2, 3, 4, 5}; | ||
return x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
discard """ | ||
targets: "c cpp" | ||
""" | ||
|
||
{.compile: "m19342.c".} | ||
|
||
# bug #19342 | ||
type | ||
Node* {.bycopy.} = object | ||
data: array[25, cint] | ||
|
||
proc myproc(name: cint): Node {.importc: "hello", cdecl.} | ||
|
||
proc parse = | ||
let node = myproc(10) | ||
doAssert node.data[0] == 999 | ||
|
||
parse() |