summary refs log tree commit diff stats
path: root/tests/method/temptybody.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/method/temptybody.nim')
-rw-r--r--tests/method/temptybody.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/method/temptybody.nim b/tests/method/temptybody.nim
new file mode 100644
index 000000000..26285d05b
--- /dev/null
+++ b/tests/method/temptybody.nim
@@ -0,0 +1,11 @@
+# bug #2401
+
+type MyClass = ref object of RootObj
+
+method HelloWorld*(obj: MyClass) =
+  when defined(myPragma):
+    echo("Hello World")
+  # discard # with this line enabled it works
+
+var obj = MyClass()
+obj.HelloWorld()