Skip to content

Commit

Permalink
Fixed sizeof spec for 32 bits
Browse files Browse the repository at this point in the history
  • Loading branch information
Ary Borenszweig committed Jan 13, 2017
1 parent bea18ec commit d27c801
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spec/compiler/codegen/sizeof_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe "Code gen: sizeof" do
end

it "can use sizeof of virtual type" do
run(%(
size = run(%(
class Foo
@x = 1
end
Expand All @@ -120,10 +120,16 @@ describe "Code gen: sizeof" do
foo = Bar.new.as(Foo)
sizeof(typeof(foo))
)).to_i.should eq(8)
)).to_i

{% if flag?(:x86_64) %}

This comment has been minimized.

Copy link
@ysbaddaden

ysbaddaden Jan 13, 2017

Contributor

Actually:

{% if flag?(:x86_64) || flag?(:aarch64) %}

Maybe we shoud introduce new flags, like abi64 and abi32? I mean, there are other 64bits archs (e.g. S/390, MIPS, RISC V, PowerPC, SPARC).

size.should eq(8)
{% else %}
size.should eq(4)
{% end %}
end

it "can use sizeof of virtual type" do
it "can use instance_sizeof of virtual type" do
run(%(
class Foo
@x = 1
Expand Down

0 comments on commit d27c801

Please sign in to comment.