diff options
Diffstat (limited to 'tests/objects/tobjcov.nim')
-rw-r--r-- | tests/objects/tobjcov.nim | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/objects/tobjcov.nim b/tests/objects/tobjcov.nim index cf2e5becf..a12f74702 100644 --- a/tests/objects/tobjcov.nim +++ b/tests/objects/tobjcov.nim @@ -1,7 +1,15 @@ +discard """ +action: compile +targets: "c" +""" + # Covariance is not type safe: +# Note: `nim cpp` makes it a compile error (after codegen), even with: +# `var f = cast[proc (x: var TA) {.nimcall.}](cast[pointer](bp))`, which +# currently removes all the `cast` in cgen'd code, hence the compile error. type - TA = object of TObject + TA = object of RootObj a: int TB = object of TA b: array[0..5000_000, int] @@ -14,4 +22,3 @@ proc bp(x: var TB) = x.b[high(x.b)] = -1 var f = cast[proc (x: var TA) {.nimcall.}](bp) var a: TA f(a) # bp expects a TB, but gets a TA - |