[Issue 20129] New: AA require with File values gives "Error: `return` expression expected" in object.d

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 13 20:26:17 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20129

          Issue ID: 20129
           Summary: AA require with File values gives "Error: `return`
                    expression expected" in object.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

/////////////// test.d //////////////
import std.stdio;

void main()
{
    File[int] aa;
    aa.require(0, File("/dev/null"));
}
/////////////////////////////////////

/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/object.d(3544):
Error: `return` expression expected
test.d(6): Error: template instance `object.require!(int, File)` error
instantiating

The cause is that File.opAssign returns void instead of File.

--


More information about the Digitalmars-d-bugs mailing list