[Issue 5526] New: Static templated functions don't work with CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 5 01:17:34 PST 2011


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

           Summary: Static templated functions don't work with CTFE
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir <thecybershadow at gmail.com> 2011-02-05 01:15:15 PST ---
string g(string who)() { return "Hello, "~who~"!"; } 

struct S
{
    static string f            () { return "Hello, world!"; } 
    static string g(string who)() { return "Hello, "~who~"!"; } 
}

void main()
{
    pragma(msg, S.f()); // works
    pragma(msg, g!("world")()); // works
    pragma(msg, S.g!("world")()); // doesn't work
}

=== Compiler output ===

$ dmd test.d
Hello, world!
Hello, world!
test.d(13): Error: Cannot interpret S at compile time
test.d(13): Error: cannot evaluate (S , g)() at compile time
(S , g)()

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


More information about the Digitalmars-d-bugs mailing list