]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Abstract and virtual methods may not be variadic
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 May 2018 12:13:04 +0000 (14:13 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 May 2018 12:19:03 +0000 (14:19 +0200)
The chain-up of the variadic parameter is not possible.

https://bugzilla.gnome.org/show_bug.cgi?id=643088

tests/Makefile.am
tests/methods/bug643088.test [new file with mode: 0644]
vala/valamethod.vala

index 764ca197f8730a3494ccc26e575ac7b95f236a93..21e80f9d7b9bb68a2da1cdfb9cf94320be3a13fe 100644 (file)
@@ -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 (file)
index 0000000..7db9be9
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+class Foo {
+       public abstract void bar (int p, ...);
+}
+
+void main () {
+}
index 95bcfbe82f7ef0f324dffe5e18aa9d7123635f70..e6d9fb59099aaaaf546659a0ed5562d5e50a88e8 100644 (file)
@@ -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;