endless loop with ref and non-ref parameter
Namespace
rswhite4 at googlemail.com
Thu Jan 24 09:24:32 PST 2013
In relation to this post:
http://forum.dlang.org/thread/hlyospppnjiziyokfvdd@forum.dlang.org?page=2#post-qxqvreqpniftjnwxvqgt:40forum.dlang.org
I dicided to test a bit with "manual" auto ref.
This Code works as expected.
[code]
import std.stdio;
struct A {
public:
}
void foo(A a) {
writeln("without ref");
foo(a);
}
void foo(ref A a) {
writeln("with ref");
}
void main() {
foo(A());
}
[/code]
it prints:
without ref
with ref
but if I change
ref A a
to
ref const A a
it turns into an endless loop.
My question is:
Is this behavior intended?
I know "const" is part of the type, but shouldn't recognize the
compiler this case?
More information about the Digitalmars-d-learn
mailing list