Bug 104 – Forward reference error occurs when the -g switch is invoked

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-04-13T05:47:00Z
Last change time
2014-02-15T13:21:42Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
clayasaurus
Blocks
340

Comments

Comment #0 by clayasaurus — 2006-04-13T05:47:00Z
The following code compiles fine with 'dmd -c bug.d', but gives a forward reference error when compiled as 'dmd -c -g bug.d' -- bug.d ---------------------------- Foofunc f; alias int function(Foo) Foofunc; -------------------------------------
Comment #1 by thomas-dloop — 2006-04-14T05:35:41Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-04-13: > The following code compiles fine with 'dmd -c bug.d', but gives a forward > reference error when compiled as 'dmd -c -g bug.d' > > -- bug.d ---------------------------- > > Foofunc f; > > alias int function(Foo) Foofunc; > > ------------------------------------- Added to DStress as http://dstress.kuehne.cn/nocompile/a/alias_34_A.d http://dstress.kuehne.cn/nocompile/a/alias_34_B.d http://dstress.kuehne.cn/nocompile/t/typedef_15_A.d http://dstress.kuehne.cn/nocompile/t/typedef_15_B.d See also: http://dstress.kuehne.cn/compile/a/alias_33_A.d http://dstress.kuehne.cn/compile/a/alias_33_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEP3y33w+/yD4P9tIRAkB4AKDIqFQPqZq+iYIke3Vz6QQeHlGYlQCdGqsV lXbrQNrZDd0VSW+YxTIPmHg= =YKyT -----END PGP SIGNATURE-----
Comment #2 by smjg — 2006-05-18T09:27:17Z
(In reply to comment #0) > The following code compiles fine with 'dmd -c bug.d' It shouldn't, because there's no definition of Foo. I'm curious about what it's doing. (In reply to comment #1) > http://dstress.kuehne.cn/compile/a/alias_33_A.d > http://dstress.kuehne.cn/compile/a/alias_33_B.d 404
Comment #3 by thomas-dloop — 2006-05-19T11:45:48Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-05-18: > http://d.puremagic.com/bugzilla/show_bug.cgi?id=104 > (In reply to comment #1) >> http://dstress.kuehne.cn/compile/a/alias_33_A.d >> http://dstress.kuehne.cn/compile/a/alias_33_B.d typo... http://dstress.kuehne.cn/nocompile/a/alias_33_A.d http://dstress.kuehne.cn/nocompile/a/alias_33_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEbbS+3w+/yD4P9tIRAhhdAJ9c7TEhVo/tdHvQIYXBrLDrUORTtgCdEKhz almvawZk0/abn3/Bs8FSRrI= =zgJh -----END PGP SIGNATURE-----
Comment #4 by clayasaurus — 2006-09-28T09:17:01Z
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.
Comment #5 by dvdfrdmn — 2006-09-28T16:55:18Z
Walter Bright wrote: > [email protected] wrote: >> http://d.puremagic.com/issues/show_bug.cgi?id=104 >> ------- Comment #4 from [email protected] 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
Comment #6 by clayasaurus — 2006-10-02T19:55:22Z
Walter Bright wrote: > [email protected] wrote: >> http://d.puremagic.com/issues/show_bug.cgi?id=104 >> ------- Comment #4 from [email protected] 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;
Comment #7 by dvdfrdmn — 2006-10-02T20:35:18Z
clayasaurus wrote: > Walter Bright wrote: >> [email protected] wrote: >>> http://d.puremagic.com/issues/show_bug.cgi?id=104 >>> ------- Comment #4 from [email protected] 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.
Comment #8 by bugzilla — 2006-10-04T20:17:57Z
Fixed DMD 0.168