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

           Summary: Unclear semantics of template value parameters
           Product: D
           Version: 2.025
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: samu...@voliacable.com


The following code compiles but the generated binary is not correct.

import std.stdio;

void foo(string s)()
{
    writefln(s);
}

void main()
{
    string s = "test";
    foo!(s);
}
----
Prints nothing. In less trivial cases, passing non-const arguments to value
parameters causes data corruption/access violations.

It is not defined whether the argument should be passed by alias or the code
should fail to compile complaining about the argument not being evaluatable at
compile time.


-- 

Reply via email to