www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10465] New: ReturnType does not store the storage class


           Summary: ReturnType does not store the storage class
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com

--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-24
13:55:34 PDT ---
import std.traits;

ref int foo(ref int);

void main()
    alias ReturnType!foo function(ParameterTypeTuple!foo) Bar;
    int x;
    Bar bar;

    static assert(!__traits(compiles, bar(5) ));  // ok, can't take r-value
    static assert(__traits(compiles, bar(x) ));  // ok, takes l-value

    pragma(msg, Bar);  // 'int function(ref int)' -- missing ref return
    bar(x) = 5;  // Error: (*bar)(x) is not an lvalue

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 24 2013