www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11761] New: is(typeof(r.methodReturningThis) == typeof(r)) fails


           Summary: is(typeof(r.methodReturningThis) == typeof(r)) fails
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com

--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2013-12-18
07:49:23 EET ---
Currently, associative arrays' byKey and byValue methods do not return forward
ranges (although this was the intention). The isForwardRange check fails.

The cause can be reduced to the following code:

struct R
    R save() { return this; }

void main()
    R r1 = void;
    static assert (is(typeof(r1.save) == typeof(r1)));

The compiler complains:

test.d(9): Error: static assert  (is(R() == R)) is false

Note the parens in "R() == R".

The problem goes away, if either r1.save is replaced with r1.save(), or the
save method declaration is annotated with  property (despite the -property
switch not being used).

Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2013