https://bugzilla.gnome.org/show_bug.cgi?id=790903
}
inst = pub_inst;
}
+
+ if (inst == null) {
+ // FIXME Report this with proper source-reference on the vala side!
+ Report.error (field.source_reference, "Invalid access to instance member `%s'".printf (field.get_full_name ()));
+ result.cvalue = new CCodeInvalidExpression ();
+ return result;
+ }
+
if (instance_target_type.data_type.is_reference_type () || (instance != null && instance.value_type is PointerType)) {
result.cvalue = new CCodeMemberAccess.pointer (inst, get_ccode_name (field));
} else {
control-flow/bug691514.vala \
control-flow/bug736774-1.vala \
control-flow/bug736774-2.vala \
+ control-flow/bug790903.test \
enums/enum_only.vala \
enums/enums.vala \
enums/flags.vala \
--- /dev/null
+Invalid Code
+
+class Foo {
+ public string field;
+}
+
+void main () {
+ var foo = (string) Foo.field;
+}