summaryrefslogtreecommitdiff
path: root/vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-02-03 13:40:23 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2021-02-27 20:08:22 +0100
commit7162e18023fa184620b07f403d6fa470b52327c8 (patch)
treec0c779b1e0877f831e3ce3a3b41752ae10318ac3 /vala
parent7260b11089b14fcd566f8dc5b61182204c4f89d6 (diff)
downloadvala-7162e18023fa184620b07f403d6fa470b52327c8.tar.gz
vala: Don't allow GLib.Value casting to nullable struct/simple types
Diffstat (limited to 'vala')
-rw-r--r--vala/valacastexpression.vala4
1 files changed, 4 insertions, 0 deletions
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala
index ef1637eaa..0dc7603c0 100644
--- a/vala/valacastexpression.vala
+++ b/vala/valacastexpression.vala
@@ -215,6 +215,10 @@ public class Vala.CastExpression : Expression {
&& is_gvalue (context, inner.value_type) && !is_gvalue (context, value_type)) {
// GValue unboxing returns unowned value
value_type.value_owned = false;
+ if (value_type.nullable && value_type.type_symbol != null && !value_type.type_symbol.is_reference_type ()) {
+ error = true;
+ Report.error (source_reference, "Casting of `GLib.Value' to `%s' is not supported".printf (value_type.to_qualified_string ()));
+ }
}
inner.target_type = inner.value_type.copy ();