[vala] Forbid implicit construction for SimpleType structs



commit 77a6580be0000e23ff99f6aba5b2e8aba1decfdc
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Apr 9 09:49:28 2011 +0200

    Forbid implicit construction for SimpleType structs
    
    Fixes bug 616600.

 vala/valaobjectcreationexpression.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index dac7d74..630f74a 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -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) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]