From: Levi Bard Date: Wed, 15 Apr 2009 20:37:51 +0000 (+0200) Subject: Fix crash with invalid property default expressions X-Git-Tag: 0.7.1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbdb5df5951ae13870e02ff3dd018b37bd4bc78b;p=thirdparty%2Fvala.git Fix crash with invalid property default expressions Do not check type compatibility on the default expression of a property if it fails semantic analysis. Fixes bug 576122. --- diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index 241fd3654..8d666dedb 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -451,7 +451,7 @@ public class Vala.Property : Member, Lockable { } } - if (default_expression != null && !(default_expression.value_type.compatible (property_type))) { + if (default_expression != null && !default_expression.error && !(default_expression.value_type.compatible (property_type))) { error = true; Report.error (default_expression.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), default_expression.value_type.to_string ())); } diff --git a/vala/valastruct.vala b/vala/valastruct.vala index 4d13ac761..cc991eb35 100644 --- a/vala/valastruct.vala +++ b/vala/valastruct.vala @@ -719,6 +719,7 @@ public class Vala.Struct : TypeSymbol { } if (!external && !external_package && base_type == null && get_fields ().size == 0) { + error = true; Report.error (source_reference, "structs cannot be empty"); }