diff options
author | Simon Werbeck <simon.werbeck@gmail.com> | 2013-03-31 23:39:32 +0200 |
---|---|---|
committer | Luca Bruno <luca.bruno@immobiliare.it> | 2014-08-29 16:54:19 +0200 |
commit | aa52b5be484f0c3d4dfcafe249bdf1c72265c778 (patch) | |
tree | 8a863a0e7c1599f870f37f33e6bd13af66fb4950 /vala | |
parent | ef9cdf86352f5d7d50b34eec6a602d7c6e13ae0a (diff) | |
download | vala-aa52b5be484f0c3d4dfcafe249bdf1c72265c778.tar.gz |
Forbid non-constant initializers for static fields in compact classes
Fixes bug 636509
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valafield.vala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/vala/valafield.vala b/vala/valafield.vala index 48986cc0c..e6429a192 100644 --- a/vala/valafield.vala +++ b/vala/valafield.vala @@ -149,6 +149,12 @@ public class Vala.Field : Variable, Lockable { return false; } + if (binding == MemberBinding.STATIC && parent_symbol is Class && ((Class)parent_symbol).is_compact && !initializer.is_constant ()) { + error = true; + Report.error (source_reference, "Static fields in compact classes cannot have non-constant initializers"); + return false; + } + if (external) { error = true; Report.error (source_reference, "External fields cannot use initializers"); |