D 2.x conversion problems

Bill Baxter dnewsgroup at billbaxter.com
Sat Dec 8 21:59:20 PST 2007


Dan wrote:
> I've been away from the scene for a while, and just picked up some old code I had rotting in the folder.
> 
> Anyways, I tried compiling it with D 2.08 and was expecting to work through the bug reports and bring it up to speed. Unfortunately, I have no freakin' clue what to do given the compiler error I'm reading; even after reading the changelog.
> 
> I would assume that somewhere in my code there is some variable named "b" that should or shouldn't be const.
> 
> Anyone able to give me a better idea of what this means?
> 
> ~~~
> 
> 
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
> 
> C:\Code\walnut>make
> rcc -r -32 source\icon.rc -otemporary\icon.res
> 
> cd source
> dmd -O -release -c -od..\temporary value.d main.d methods.d structure.d text.d test.d
> Error: 'b' is not a member of 'const(Value)'
> 
> --- errorlevel 1
> 
> C:\Code\walnut>

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.  :-)

--bb


More information about the Digitalmars-d-learn mailing list