D 2.x conversion problems

Brad Roberts braddr at puremagic.com
Sat Dec 8 22:20:52 PST 2007


Dan wrote:
> 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?

Once you track down what part of your code is tripping that error, 
please file a bug report, with a nice easy repro case, so the lack of a 
line number can be fixed.  Missing line numbers for errors is just evil.

Thanks,
Brad



More information about the Digitalmars-d-learn mailing list