diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0e3a606..ac94456 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4058,7 +4058,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return null;
 	}
 
-	bool is_limited_generic_type (DataType type) {
+	private static bool is_limited_generic_type (DataType type) {
 		var cl = type.type_parameter.parent_symbol as Class;
 		var st = type.type_parameter.parent_symbol as Struct;
 		if ((cl != null && cl.is_compact) || st != null) {
@@ -4090,7 +4090,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 		return true;
 	}
 
-	public bool requires_destroy (DataType type) {
+	public static bool requires_destroy (DataType type) {
 		if (!type.is_disposable ()) {
 			return false;
 		}
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index a6b73b9..e47c180 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -216,6 +216,36 @@ public class Vala.Assignment : Expression {
 			return false;
 		}
 
+		/* check lifetime if:
+				lvalue is a reference data type
+				rvalue is a reference data type but not constant (like null)
+				lvalue is unowned
+				if lvalue and rvalue have a valid scope
+				if rvalue scope is strictly subscope of lvalue scope
+			then 
+				it is possible to use lvalue with invalid data 
+		*/
+		if (left.value_type != null && right.value_type != null && left.value_type.data_type != null && right.value_type.data_type != null) {
+			if (left.value_type.data_type.is_reference_type()) {
+				if (right.value_type.data_type.is_reference_type() && !(right.is_constant ())) {
+					if (!(left.value_type is PointerType) && !(left.value_type.value_owned)) {
+						if ((left.symbol_reference != null) && (right.symbol_reference != null)) {
+							Scope leftScope = left.symbol_reference.owner;
+							Scope rightScope = right.symbol_reference.owner;
+							if (leftScope != null && rightScope != null) {
+								if (rightScope.is_subscope_of(leftScope) && !(leftScope.is_subscope_of(rightScope))) {
+									error = true;
+									Report.warning (source_reference, 
+									"Invalid assignment to unowned lvalue: rvalue with reduced lifetime");
+								}
+							}
+						}
+
+					}
+				}
+			}
+		}
+
 		if (operator != AssignmentOperator.SIMPLE && left is MemberAccess) {
 			// transform into simple assignment
 			// FIXME: only do this if the backend doesn't support
