Structs with pointers?
bearophile
bearophileHUGS at lycos.com
Sat Jan 22 15:02:02 PST 2011
> Is this another compiler bug?
The situation is nice:
struct Foo1 {}
struct Foo2 { int x; }
const struct Foo3 { int* p; }
struct Foo4 { int* p; }
void bar1(Foo1 f) {}
void bar2(Foo2 f) {}
void bar3(Foo3 f) {}
void bar4(Foo4 f) {}
void main() {
const f1 = Foo1();
bar1(f1); // no error
const f2 = Foo2();
bar2(f2); // no error
const f3 = Foo3();
bar3(f3); // no error
const f4 = Foo4();
bar4(f4); // error
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list