Thread overview
[Issue 104] Forward reference error occurs when the -g switch is invoked
Sep 28, 2006
d-bugmail
Sep 28, 2006
Walter Bright
Sep 28, 2006
Bradley Smith
Sep 28, 2006
Walter Bright
Oct 03, 2006
clayasaurus
Oct 03, 2006
Bradley Smith
Oct 05, 2006
d-bugmail
September 28, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=104


clayasaurus@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Flag|                            |d1.0blocker?




------- Comment #4 from clayasaurus@gmail.com  2006-09-28 09:17 -------
This issue prevents being able to produce debug info if you use DerelictFreeType library, which is a pretty big issue for a number of D game developers. Who knows how many times I've explained this bug. I'd suggest this as a 1.0 blocker.


-- 

September 28, 2006
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=104
> ------- Comment #4 from clayasaurus@gmail.com  2006-09-28 09:17 -------
> This issue prevents being able to produce debug info if you use
> DerelictFreeType library, which is a pretty big issue for a number of D game
> developers. Who knows how many times I've explained this bug. I'd suggest this
> as a 1.0 blocker. 

Why is it a blocker when it is illegal code anyway? (Foo is undefined.)
September 28, 2006
Walter Bright wrote:
> d-bugmail@puremagic.com wrote:
>> http://d.puremagic.com/issues/show_bug.cgi?id=104
>> ------- Comment #4 from clayasaurus@gmail.com  2006-09-28 09:17 -------
>> This issue prevents being able to produce debug info if you use
>> DerelictFreeType library, which is a pretty big issue for a number of D game
>> developers. Who knows how many times I've explained this bug. I'd suggest this
>> as a 1.0 blocker. 
> 
> Why is it a blocker when it is illegal code anyway? (Foo is undefined.)

How about this code?

--- bug.d ---
Foofunc f;
typedef int Foo;
alias int function(Foo) Foofunc;
------

It compiles with dmd -c bug.d, but dmd -c -g bug.d fails with the following:

error: forward reference of Foo

Of course the workaround is to change the code to

typedef int Foo;
alias int function(Foo) Foofunc;
Foofunc f;


  Bradley
September 28, 2006
Thanks, that's much better.
October 03, 2006
Walter Bright wrote:
> d-bugmail@puremagic.com wrote:
>> http://d.puremagic.com/issues/show_bug.cgi?id=104
>> ------- Comment #4 from clayasaurus@gmail.com  2006-09-28 09:17 -------
>> This issue prevents being able to produce debug info if you use
>> DerelictFreeType library, which is a pretty big issue for a number of D game
>> developers. Who knows how many times I've explained this bug. I'd suggest this
>> as a 1.0 blocker. 
> 
> Why is it a blocker when it is illegal code anyway? (Foo is undefined.)

Here is another example, I'm not sure if it is much better.


struct FT_Var_Named_Style{
T1_Decoder_Callback f;
}

alias int function( T1_DecoderRec decoder ) T1_Decoder_Callback;
October 03, 2006
clayasaurus wrote:
> Walter Bright wrote:
>> d-bugmail@puremagic.com wrote:
>>> http://d.puremagic.com/issues/show_bug.cgi?id=104
>>> ------- Comment #4 from clayasaurus@gmail.com  2006-09-28 09:17 -------
>>> This issue prevents being able to produce debug info if you use
>>> DerelictFreeType library, which is a pretty big issue for a number of D game
>>> developers. Who knows how many times I've explained this bug. I'd suggest this
>>> as a 1.0 blocker. 
>>
>> Why is it a blocker when it is illegal code anyway? (Foo is undefined.)
> 
> Here is another example, I'm not sure if it is much better.
> 
> 
> struct FT_Var_Named_Style{
> T1_Decoder_Callback f;
> }
> 
> alias int function( T1_DecoderRec decoder ) T1_Decoder_Callback;

What I don't understand is why the code above does not give an "T1_DecoderRec undefined" error. Doesn't the compiler require the types of arguments in function statements to be defined?

This incorrectly compiles without errors. It should give a Foo undefined error. With -g, compiling gives a Foo forward reference error.

  Foofunc f;
  alias int function(Foo) Foofunc;

This correctly doesn't compile. It gives a Foo undefined error.

  alias int function(Foo) Foofunc;
  Foofunc f;

This correctly compiles, but with -g, gives a Foo forward reference error.

  Foofunc f;
  alias int function(Foo) Foofunc;
  alias int Foo;

There appear to be two bugs: the forward reference error, and the mishandling of the argument types in function aliases.
October 05, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=104


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #8 from bugzilla@digitalmars.com  2006-10-04 20:17 -------
Fixed DMD 0.168


--