View mode: basic / threaded / horizontal-split · Log in · Help
December 09, 2007
D 2.x conversion problems
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>
December 09, 2007
Re: D 2.x conversion problems
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
December 09, 2007
Re: D 2.x conversion problems
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?
December 09, 2007
Re: D 2.x conversion problems
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
December 09, 2007
Re: D 2.x conversion problems
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?

Sorry, I should have provided the code I think it might be.  I honestly don't seen anything wrong with it, because it worked on 1.05 (which I now can't download and run because it doesn't work)

[code]
struct Value {
	union {		
		struct {
			uint length;
			char[]* keys;
			Value* values;
		}
		struct {
			union {
				Value[] sf;
				Value function(inout Value self,inout Value cc,Value[] arguments ...) nf;
			}
			ubyte arity;
		}
		Value[] a;
		char[] s;
		bool b;
		int i;
		double d;
		d_time dt;
	}
struct Value {
	union {		
		struct {
			uint length;
			char[]* keys;
			Value* values;
		}
		struct {
			union {
				Value[] sf;
				Value function(inout Value self,inout Value cc,Value[] arguments ...) nf;
			}
			ubyte arity;
		}
		Value[] a;
		char[] s;
		bool b;
		int i;
		double d;
		d_time dt;
	}
struct Value {
	union {		
		struct {
			uint length;
			char[]* keys;
			Value* values;
		}
		struct {
			union {
				Value[] sf;
				Value function(inout Value self,inout Value cc,Value[] arguments ...) nf;
			}
			ubyte arity;
		}
		Value[] a;
		char[] s;
		bool b;
		int i;
		double d;
		d_time dt;
	}
...
[/code]
December 09, 2007
Re: D 2.x conversion problems
Please forgive that last post's duplication.

Also, I've gone ahead and tried a minimal case for that struct, and it works just fine, and I can declare and initalize the struct.

So, I have no idea what far corner of my program is causing the error.  There are over 20,000 lines of code, and Value.b is pervasive in 4 out of 7 files.  Since there's absolutely nothing about changing bool or anonymous unions listed in the changelogs, I'd assume this is a bug of some sort.  I just don't know what kind of code generates the bug, since the error message is so amazingly ambiguous.

Regards,
Dan
December 09, 2007
Re: D 2.x conversion problems
On Sun, 09 Dec 2007 00:45:53 -0500, 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>

Since you've been away from the scene for awhile figured you might not 
know that D has branched to a stable v1 and add/break stuff v2. If so I 
would suggest using dmd1.004.

http://ftp.digitalmars.com/dmd.1.024.zip
December 13, 2007
Re: D 2.x conversion problems
Jesse Phillips Wrote:

> Since you've been away from the scene for awhile figured you might not 
> know that D has branched to a stable v1 and add/break stuff v2. If so I 
> would suggest using dmd1.004.
> 
> http://ftp.digitalmars.com/dmd.1.024.zip

I tried 1.005 before, and it was throwing me a similar error (the "b is not a member of Value" one)

So I tried 1.001 and got "cannot find dmd" (which is really a cannot find link.exe, 'cause it really doesn't exist)

So I've since been wondering how I'm supposed to acquire link.exe when it's not in any of the dmd compiler packages, and not in the same package I got rcc from.

*sigh*

Anyone have the executable off-hand?
December 13, 2007
Re: D 2.x conversion problems
Dan Wrote:

> Jesse Phillips Wrote:
> 
> > Since you've been away from the scene for awhile figured you might not 
> > know that D has branched to a stable v1 and add/break stuff v2. If so I 
> > would suggest using dmd1.004.
> > 
> > http://ftp.digitalmars.com/dmd.1.024.zip
> 
> I tried 1.005 before, and it was throwing me a similar error (the "b is not a member of Value" one)
> 
> So I tried 1.001 and got "cannot find dmd" (which is really a cannot find link.exe, 'cause it really doesn't exist)
> 
> So I've since been wondering how I'm supposed to acquire link.exe when it's not in any of the dmd compiler packages, and not in the same package I got rcc from.
> 
> *sigh*
> 
> Anyone have the executable off-hand?

nm, got it from dmc.zip.  : p
December 17, 2007
Re: D 2.x conversion problems
== Quote from Brad Roberts (braddr@puremagic.com)'s article
...
> 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

I came up with a small test case for an error with a missing line number. I posted
it as:
http://d.puremagic.com/issues/show_bug.cgi?id=1738
Top | Discussion index | About this forum | D home