diff options
Diffstat (limited to 'tests/template/twrongopensymchoice.nim')
-rw-r--r-- | tests/template/twrongopensymchoice.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/template/twrongopensymchoice.nim b/tests/template/twrongopensymchoice.nim new file mode 100644 index 000000000..7a2bb48d3 --- /dev/null +++ b/tests/template/twrongopensymchoice.nim @@ -0,0 +1,24 @@ +discard """ + output: '''10''' +""" + +# bug #940 + +type + Foo* = ref object + b*: int + +proc new*(this: var Foo) = + assert this != nil + this.b = 10 + +proc new*(T: typedesc[Foo]): Foo = + system.new(result) + twrongopensymchoice.new(result) + +proc main = + var f = Foo.new() + echo f.b + +when true: + main() |