www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5526] New: Static templated functions don't work with CTFE

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: thecybershadow gmail.com



---
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: -------
Feb 05 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5526


Vladimir <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



---
Oops, I stumbled upon the exact same bug a while ago.

*** This issue has been marked as a duplicate of issue 3959 ***

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