]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix address-of operator for pointer element access
authorJürg Billeter <j@bitron.ch>
Thu, 7 Oct 2010 16:44:03 +0000 (18:44 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 8 Oct 2010 21:07:01 +0000 (23:07 +0200)
vala/valaaddressofexpression.vala

index 83754e5cd05e1dedbb8402910d32dc5ec9e2d270..1d27aee2adce30cc43c237b986799fe0b6ce33af 100644 (file)
@@ -81,10 +81,12 @@ public class Vala.AddressofExpression : Expression {
                        error = true;
                        return false;
                }
+               var ea = inner as ElementAccess;
                if (inner is MemberAccess && inner.symbol_reference is Variable) {
                        // address of variable is always possible
-               } else if (inner is ElementAccess && ((ElementAccess) inner).container.value_type is ArrayType) {
-                       // address of element of regular array is always possible
+               } else if (ea != null &&
+                          (ea.container.value_type is ArrayType || ea.container.value_type is PointerType)) {
+                       // address of element of regular array or pointer is always possible
                } else {
                        error = true;
                        Report.error (source_reference, "Address-of operator not supported for this expression");