Bug 1078 – Frontend uses of 'auto' where 'scope' should be used

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-03-22T14:47:00Z
Last change time
2014-02-16T15:23:51Z
Keywords
diagnostic, patch
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2007-03-22T14:47:12Z
Instances in the frontend where error messages say "auto" when they should say "scope": declaration.c, lines 755 and 761. Code showcase: scope class Foo {} Foo f; expression.c, line 3175. Code showcase: void main() { scope f = new Object; return f; } func.c, line 135. Code showcase: scope void main() {} mtype.c, line 2680. Code showcase: scope class Foo {} Foo foo();
Comment #1 by matti.niemenmaa+dbugzilla — 2007-03-22T14:49:41Z
Realized that it might be easier to fix in a development version of DMD if I gave you the lines as well as the line numbers... declaration.c, 755: error("globals, statics, fields, inout and out parameters cannot be auto"); declaration.c, 761: error("reference to auto class must be auto"); expression.c, 3175: error("escaping reference to auto local %s", v->toChars()); func.c, 135: error("functions cannot be const or auto"); mtype.c, 2680: error(loc, "functions cannot return auto %s", next->toChars());
Comment #2 by matti.niemenmaa+dbugzilla — 2007-03-23T12:18:39Z
*** Bug 518 has been marked as a duplicate of this bug. ***
Comment #3 by matti.niemenmaa+dbugzilla — 2007-03-23T12:33:34Z
func.c, line 135 should actually probably say "const, auto, or scope" since the error is generated also for code like the following: auto void main() {}
Comment #4 by clugdbug — 2009-04-03T07:37:24Z
Fixed DMD2.023