[Issue 2733] New: Unclear semantics of template value parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 15 02:59:48 PDT 2009


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: bugzilla at digitalmars.com
        ReportedBy: samukha at 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.


-- 



More information about the Digitalmars-d-bugs mailing list