From: Rico Tzschichholz Date: Mon, 14 May 2018 12:13:04 +0000 (+0200) Subject: vala: Abstract and virtual methods may not be variadic X-Git-Tag: 0.41.90~131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fb5abc08093427790bc8dbae3e1cc92ee92f0bd;p=thirdparty%2Fvala.git vala: Abstract and virtual methods may not be variadic The chain-up of the variadic parameter is not possible. https://bugzilla.gnome.org/show_bug.cgi?id=643088 --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 764ca197f..21e80f9d7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -90,6 +90,7 @@ TESTS = \ methods/bug642350.vala \ methods/bug642885.vala \ methods/bug642899.vala \ + methods/bug643088.test \ methods/bug646345.vala \ methods/bug648030.test \ methods/bug648320.vala \ diff --git a/tests/methods/bug643088.test b/tests/methods/bug643088.test new file mode 100644 index 000000000..7db9be92c --- /dev/null +++ b/tests/methods/bug643088.test @@ -0,0 +1,8 @@ +Invalid Code + +class Foo { + public abstract void bar (int p, ...); +} + +void main () { +} diff --git a/vala/valamethod.vala b/vala/valamethod.vala index 95bcfbe82..e6d9fb590 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -647,6 +647,12 @@ public class Vala.Method : Subroutine, Callable { } } + if (is_variadic () && (is_abstract || is_virtual)) { + error = true; + Report.error (source_reference, "Abstract and virtual methods may not be variadic. Use a `va_list' parameter instead of `...'."); + return false; + } + if (is_abstract) { if (parent_symbol is Class) { var cl = (Class) parent_symbol;