www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3322] New: Pure member functions can not call other pure member functions.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3322

           Summary: Pure member functions can not call other pure member
                    functions.
           Product: D
           Version: 2.032
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: sandford jhu.edu



Member functions marked as pure can not be called from other pure functions. 

struct foo {
    real a() pure {
        return 1.0;
    }
    real b() pure {
        return a; // Error on this line
    }
}

Error: function main.foo.a () is not callable using argument types ()

Marking a() as pure const allows code to compile, and produces correct results.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3322


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed DMD2.050.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 08 2010