Bug 159 – forward reference with invalid struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-05-27T14:57:00Z
Last change time
2014-02-15T13:21:54Z
Keywords
diagnostic
Assigned to
bugzilla
Creator
benoit

Comments

Comment #0 by benoit — 2006-05-27T14:57:51Z
This compiled with dmd 0.157. Well i think its not legal code ... public struct S; // this should be an error, i think public struct S1 { // error is show here S s; } Error: mod.d(7): struct mod.S1 unable to resolve forward reference
Comment #1 by bugzilla — 2006-06-01T14:25:50Z
It's ok to declare a struct without { }. However, this won't work if the size of S is needed, as it is in S1. Hence, the error diagnostic.
Comment #2 by smjg — 2006-06-02T09:02:45Z
Since when has "forward reference" meant this? In my vocabulary, a forward reference is when you refer to something before it's declared. Which isn't happening here. A forward _declaration_, OTOH, is when you declare something and then define it later. This would be a forward declaration except that in this example, S is never defined. As such, what we have isn't a forward anything. So of course it's a badly written error message. A better error would be: mod.d(7): unable to resolve declaration of type S - size is unknown
Comment #3 by bugzilla — 2006-06-20T02:22:21Z
Fixed DMD 0.161 (better error message)