D - enum bug
- Vathix (7/7) Sep 09 2003 I had an enum inside a class in another module I imported, I had a varia...
- Walter (4/11) Sep 09 2003 Can you post a complete example, please?
- Vathix (4/5) Sep 11 2003 I can't seem to get it to happen for a small example. It has happened to...
- Walter (5/10) Sep 12 2003 me
- Adam Harper (35/44) Sep 13 2003 Was the error something like "enum_test.d(17): no property 'x' for type
- Vathix (3/48) Sep 13 2003 Yes! This is it.
I had an enum inside a class in another module I imported, I had a variable of the enum type and did this: foo |= TheClass.TheEnum.m; The compiler said something about m not being a property of uint. I did this and it was fine: alias TheClass.TheEnum Bar; foo |= Bar.m;
Sep 09 2003
Can you post a complete example, please? "Vathix" <vathix dprogramming.com> wrote in message news:bjmcr1$thj$1 digitaldaemon.com...I had an enum inside a class in another module I imported, I had avariableof the enum type and did this: foo |= TheClass.TheEnum.m; The compiler said something about m not being a property of uint. I did this and it was fine: alias TheClass.TheEnum Bar; foo |= Bar.m;
Sep 09 2003
Can you post a complete example, please?I can't seem to get it to happen for a small example. It has happened to me a couple times but in a lot of code. I could give you all the code but that might be harder to track than trying to find something in the compiler's code, since you already know it...
Sep 11 2003
"Vathix" <vathix dprogramming.com> wrote in message news:bjqn8p$r96$1 digitaldaemon.com...meCan you post a complete example, please?I can't seem to get it to happen for a small example. It has happened toa couple times but in a lot of code. I could give you all the code butthatmight be harder to track than trying to find something in the compiler's code, since you already know it...What you deleted to make the problem disappear is likely the real bug <g>.
Sep 12 2003
On Wed, 10 Sep 2003 01:35:25 -0400, Vathix wrote:I had an enum inside a class in another module I imported, I had a variable of the enum type and did this: foo |= TheClass.TheEnum.m; The compiler said something about m not being a property of uint.Was the error something like "enum_test.d(17): no property 'x' for type 'int'"? If so then I think the following might explain it, if not then feel free to ignore this message :-) Given the following source code: import c.stdio; class A { enum E{ u = 1, v, w }; }; class B { enum E{ x = 4, y, z }; }; int main( char[][] args ) { printf( "A.E.u = %d\n", A.E.u ); printf( "B.E.x = %d\n", B.E.x ); // Error here return 0; }; The compiler gives the following error:enum.d(17): no property 'x' for type 'int'Changing the main method to: int main( char[][] args ) { alias A.E ae; alias B.E be; printf( "A.E.u = %d\n", ae.u ); printf( "B.E.x = %d\n", be.x ); return 0; }; Will compile and result in the following (expected) output:A.E.u = 1 B.E.x = 4In the first example "B.E.x" actually refers to "A.E.x" which causes an error because the enum E in class A has no "x" property. Why it does this, and why using aliases works, is something I don't know.
Sep 13 2003
"Adam Harper" <a-news-d harper.nu> wrote in message news:pan.2003.09.13.09.44.20.787032 harper.nu...On Wed, 10 Sep 2003 01:35:25 -0400, Vathix wrote:Yes! This is it.I had an enum inside a class in another module I imported, I had a variable of the enum type and did this: foo |= TheClass.TheEnum.m; The compiler said something about m not being a property of uint.Was the error something like "enum_test.d(17): no property 'x' for type 'int'"? If so then I think the following might explain it, if not then feel free to ignore this message :-) Given the following source code: import c.stdio; class A { enum E{ u = 1, v, w }; }; class B { enum E{ x = 4, y, z }; }; int main( char[][] args ) { printf( "A.E.u = %d\n", A.E.u ); printf( "B.E.x = %d\n", B.E.x ); // Error here return 0; }; The compiler gives the following error:enum.d(17): no property 'x' for type 'int'Changing the main method to: int main( char[][] args ) { alias A.E ae; alias B.E be; printf( "A.E.u = %d\n", ae.u ); printf( "B.E.x = %d\n", be.x ); return 0; }; Will compile and result in the following (expected) output:A.E.u = 1 B.E.x = 4In the first example "B.E.x" actually refers to "A.E.x" which causes an error because the enum E in class A has no "x" property. Why it does this, and why using aliases works, is something I don't know.
Sep 13 2003