diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-09-14 23:28:43 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-09-14 23:30:48 +0200 |
commit | 8ac0970f22a1ba41a9a0ac47f86c97e99a44e113 (patch) | |
tree | 8ac2892f063796a0454e93bae6e55ba591f142f7 /vala/valacastexpression.vala | |
parent | 6ad11279231bb819b286451e2116d8202e13af92 (diff) | |
download | vala-8ac0970f22a1ba41a9a0ac47f86c97e99a44e113.tar.gz |
vala: Warn about unsupported cast to void and drop it
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1070
Diffstat (limited to 'vala/valacastexpression.vala')
-rw-r--r-- | vala/valacastexpression.vala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vala/valacastexpression.vala b/vala/valacastexpression.vala index 9aff511fa..1d1dbb0f2 100644 --- a/vala/valacastexpression.vala +++ b/vala/valacastexpression.vala @@ -164,6 +164,13 @@ public class Vala.CastExpression : Expression { // FIXME: check whether cast is allowed + if (type_reference is VoidType) { + Report.warning (source_reference, "Casting to `void' is not supported"); + context.analyzer.replaced_nodes.add (this); + parent_node.replace_expression (this, inner); + return inner.check (context); + } + if (type_reference is DelegateType && inner.value_type is MethodType) { if (target_type != null) { inner.value_type.value_owned = target_type.value_owned; |