1
1
discard """
2
- targets: "c js"
2
+ targets: "c cpp js"
3
+ matrix: "; -d:release"
3
4
"""
4
5
5
6
type T = object
@@ -79,7 +80,7 @@ someGlobalPtr[] = 10
79
80
doAssert (someGlobal == 10 )
80
81
81
82
block :
82
- # issue #14576
83
+ # bug #14576
83
84
# lots of these used to give: Error: internal error: genAddr: 2
84
85
proc byLent [T](a: T): lent T = a
85
86
proc byPtr [T](a: T): ptr T = a.unsafeAddr
@@ -89,24 +90,21 @@ block:
89
90
let (x,y) = byLent (a)
90
91
doAssert (x,y) == a
91
92
92
- block :
93
- when defined (c) and defined (release):
94
- # bug; pending https://github.com/nim-lang/Nim/issues/14578
95
- discard
96
- else :
97
- let a = 10
98
- doAssert byLent (a) == 10
99
- let a2 = byLent (a)
100
- doAssert a2 == 10
93
+ block : # (with -d:release) bug #14578
94
+ let a = 10
95
+ doAssert byLent (a) == 10
96
+ let a2 = byLent (a)
97
+ doAssert a2 == 10
101
98
102
99
block :
103
- let a = [11 ,12 ]
104
- doAssert byLent (a) == [11 ,12 ]
100
+ when not defined (cpp): # pending bug #15958
101
+ let a = [11 ,12 ]
102
+ doAssert byLent (a) == [11 ,12 ]
105
103
let a2 = (11 ,)
106
104
doAssert byLent (a2) == (11 ,)
107
105
108
106
block :
109
- when defined (c) and defined (release):
107
+ when ( defined (c) or defined (cpp) ) and defined (release):
110
108
discard # probably not a bug since optimizer is free to pass by value, and `unsafeAddr` is used
111
109
else :
112
110
var a = @ [12 ]
@@ -134,6 +132,6 @@ block:
134
132
bar (a2).inc
135
133
doAssert a2 == 13
136
134
137
- block : # xxx: bug this doesn't work
135
+ block : # pending bug #15959
138
136
when false :
139
137
proc byLent2 [T](a: T): lent type (a[0 ]) = a[0 ]
0 commit comments