D 2.x conversion problems

Dan murpsoft at hotmail.com
Sat Dec 8 22:23:26 PST 2007


Bill Baxter Wrote:
Dan Wrote:
> > Error: 'b' is not a member of 'const(Value)'
> > 
> > --- errorlevel 1
> Shot in the dark here, but it reminds me of error messages I've seen 
> from using named unions.
> 
> Somewhere in the past you used to be able to say
> struct Value
> {
>     union b{
>        int i;
>        long l;
>     }
> }
> 
> Value x;
> x.b.i; // was ok at some point in the past
> 
> But that became an error.  And I believe the error message was something 
> like "b is not a member of Value".  The fix is to do something like:
> 
> struct Value {
>     union _b {
>        int i;
>        long l;
>     }
>     _b b;
> }
> 
> Sorry if this is wrong and leads you down the wrong path!  But you're 
> not giving us a lot to go on.  :-)

No, that's quite informative.  The error I was given was not alot to go on either.  I was pretty shocked it didn't even give me a line number or even a specific file that needed changing.

Now I know I'm probably looking for a named union type.  Does it matter that I have about six dozen "anonymous" unions inside my structs?



More information about the Digitalmars-d-learn mailing list