[Issue 2509] New: You can not create the function returns ref instead of statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 12 14:42:32 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2509

           Summary: You can not create the function returns ref instead of
                    statement
           Product: D
           Version: 2.021
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: resume755 at mail.ru


this code causes the error:

void main()
{
    int i;

    ref int func()
    {
      return i;
    }

    func() = 4;
}

lval.d(5): found 'ref' instead of statement
lval.d(10): no identifier for declarator func
lval.d(11): unrecognized declaration


but code like this compiles:

ref int func()
{
  int* i = new int;
  return *i;
}

void main()
{
    func() = 4;
}


-- 



More information about the Digitalmars-d-bugs mailing list