diff --git a/Examples/test-suite/csharp/default_args_runme.cs b/Examples/test-suite/csharp/default_args_runme.cs index 427bf05bd..75a2d3535 100644 --- a/Examples/test-suite/csharp/default_args_runme.cs +++ b/Examples/test-suite/csharp/default_args_runme.cs @@ -129,6 +129,12 @@ public class runme if (default_args.constructorcall(new Klass()).val != -1) throw new Exception("constructorcall test 3 failed"); + // const methods + ConstMethods cm = new ConstMethods(); + if (cm.coo() != 20) + throw new Exception("coo test 1 failed"); + if (cm.coo(1.0) != 20) + throw new Exception("coo test 2 failed"); } } diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i index c079a4bc1..cd891148a 100644 --- a/Examples/test-suite/default_args.i +++ b/Examples/test-suite/default_args.i @@ -180,6 +180,21 @@ Klass constructorcall(const Klass& k = Klass()) { return k; } } %} +// const methods +// runtime test needed to check that the const method is called +struct ConstMethods { + int coo(double d = 0.0) const; +}; + +%{ +struct ConstMethods { + int coo(double d = 0.0) { return 10; } + int coo(double d = 0.0) const { return 20; } +}; +%} + + +// Default args with C linkage %inline %{ extern "C" double cfunc1(double x,double p = 1) { diff --git a/Examples/test-suite/java/default_args_runme.java b/Examples/test-suite/java/default_args_runme.java index 85417cabc..45e2676d4 100644 --- a/Examples/test-suite/java/default_args_runme.java +++ b/Examples/test-suite/java/default_args_runme.java @@ -137,5 +137,11 @@ public class default_args_runme { if (default_args.constructorcall(new Klass()).getVal() != -1) throw new RuntimeException("constructorcall test 3 failed"); + // const methods + ConstMethods cm = new ConstMethods(); + if (cm.coo() != 20) + throw new RuntimeException("coo test 1 failed"); + if (cm.coo(1.0) != 20) + throw new RuntimeException("coo test 2 failed"); } } diff --git a/Examples/test-suite/perl5/default_args_runme.pl b/Examples/test-suite/perl5/default_args_runme.pl index 31a7daa8f..c0fb7acad 100644 --- a/Examples/test-suite/perl5/default_args_runme.pl +++ b/Examples/test-suite/perl5/default_args_runme.pl @@ -147,3 +147,12 @@ if (default_args::constructorcall(new default_args::Klass())->{val} != -1) { die "constructorcall test 3 failed"; } +# const methods +$cm = new default_args::ConstMethods(); +if ($cm->coo() != 20) { + die "coo test 1 failed"; +} +if ($cm->coo(1.0) != 20) { + die "coo test 2 failed"; +} +