Commit 714bfd14 authored by Florian Brosch's avatar Florian Brosch

tag sizeof as constant

parent 980273a8
......@@ -20,6 +20,7 @@ TESTS = \
basic-types/strings.vala \
basic-types/arrays.vala \
basic-types/pointers.vala \
basic-types/sizeof.vala \
basic-types/bug591552.vala \
basic-types/bug595751.vala \
basic-types/bug596637.vala \
......
public const size_t simple_size = sizeof (int);
public const size_t composed_size = sizeof (int) + sizeof (size_t);
static void main () {
assert (composed_size == (sizeof (int) + sizeof (size_t)));
assert (simple_size == sizeof (int));
}
......@@ -65,6 +65,10 @@ public class Vala.SizeofExpression : Expression {
return true;
}
public override bool is_constant () {
return true;
}
public override void replace_type (DataType old_type, DataType new_type) {
if (type_reference == old_type) {
type_reference = new_type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment