Bug 5828 – Cannot declare a variable of type "X function() ref"

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-04-10T01:16:00Z
Last change time
2011-06-06T21:26:33Z
Keywords
rejects-valid
Assigned to
nobody
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2011-04-10T01:16:36Z
DMD rejects explicit declarations of variables of type "X function() ref", while internally this is a valid type: int a; ref int g(){return a;} int main(){ //ref int function() f=&g; //error //int function ref() f=&g; //error auto f=&g; //ok writeln(typeof(f).stringof); //"int function() ref" }
Comment #1 by timon.gehr — 2011-04-11T05:19:38Z
There is a typo: I meant to write //int function() ref f=&g; //error Instead of //int function ref() f=&g; //error
Comment #2 by yebblies — 2011-06-06T21:26:33Z
*** This issue has been marked as a duplicate of issue 2753 ***