Thread overview
[Issue 1078] New: Frontend uses of 'auto' where 'scope' should be used
Mar 22, 2007
d-bugmail
Mar 22, 2007
d-bugmail
Mar 23, 2007
d-bugmail
Mar 23, 2007
d-bugmail
Apr 03, 2009
d-bugmail
March 22, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1078

           Summary: Frontend uses of 'auto' where 'scope' should be used
           Product: D
           Version: 1.009
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic, patch
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: deewiant@gmail.com


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();


-- 

March 22, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1078





------- Comment #1 from deewiant@gmail.com  2007-03-22 14:49 -------
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());


-- 

March 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1078





------- Comment #2 from deewiant@gmail.com  2007-03-23 12:18 -------
*** Bug 518 has been marked as a duplicate of this bug. ***


-- 

March 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1078





------- Comment #3 from deewiant@gmail.com  2007-03-23 12:33 -------
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() {}


-- 

April 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1078


clugdbug@yahoo.com.au changed:

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




------- Comment #4 from clugdbug@yahoo.com.au  2009-04-03 07:37 -------
Fixed DMD2.023


--