Strange constant resolution behaviour after Class#dup


#1

Hello,

the following code produces different results when executed with Ruby
1.8.6 on Windows and Fedora 9:

class A
def call_b_with_dup
B.dup.new.b
end
def call_b_without_dup
B.new.b
end
end

class B
def b
XXX
end
end

begin
A.new.call_b_with_dup
rescue Exception => e
puts e
end

begin
A.new.call_b_without_dup
rescue Exception => e
puts e
end

*** Results ***

Windows:

uninitialized constant B::XXX
uninitialized constant B::XXX

Fedora 9:

uninitialized constant A::XXX
uninitialized constant B::XXX

Whats the correct behaviour? I suppose the first one and the second is a
bug.
If so, is this bug already known?

Thanks,

Martin