]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Forbid implicit construction for SimpleType structs
authorLuca Bruno <lucabru@src.gnome.org>
Sat, 9 Apr 2011 07:49:28 +0000 (09:49 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 9 Apr 2011 07:59:29 +0000 (09:59 +0200)
Fixes bug 616600.

vala/valaobjectcreationexpression.vala

index dac7d74ef0c884ce9dece9a52ddf4d5c90ce6069..630f74a07f8a46c3ac8e17253a56ce7e0061adca 100644 (file)
@@ -294,6 +294,12 @@ public class Vala.ObjectCreationExpression : Expression {
                        if (symbol_reference == null) {
                                symbol_reference = st.default_construction_method;
                        }
+
+                       if (st.is_simple_type () && symbol_reference == null) {
+                               error = true;
+                               Report.error (source_reference, "`%s' does not have a default constructor".printf (st.get_full_name ()));
+                               return false;
+                       }
                }
 
                if (expected_num_type_args > given_num_type_args) {