]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Error on non-const field initializer in namespace
authorSimon Werbeck <simon.werbeck@gmail.com>
Mon, 1 Apr 2013 03:00:12 +0000 (05:00 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 23 Aug 2014 17:52:27 +0000 (19:52 +0200)
Fixes bug 569259

vala/valafield.vala

index 8b932a5df6ea0eee30fce0dbde5301dc5e0c6241..48986cc0c97669efa4b3c2a39405c4146c3475a9 100644 (file)
@@ -143,6 +143,12 @@ public class Vala.Field : Variable, Lockable {
                                return false;
                        }
 
+                       if (parent_symbol is Namespace && !initializer.is_constant ()) {
+                               error = true;
+                               Report.error (source_reference, "Non-constant field initializerS not supported in this context");
+                               return false;
+                       }
+
                        if (external) {
                                error = true;
                                Report.error (source_reference, "External fields cannot use initializers");