[Issue 9949] New: template initialization when alias cannot be read at compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 17 06:17:03 PDT 2013


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

           Summary: template initialization when alias cannot be read at
                    compile time
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: luka8088 at owave.net


--- Comment #0 from luka8088 <luka8088 at owave.net> 2013-04-17 06:17:01 PDT ---
The following code compiles aldo s is not readable at compile time:

struct S (alias T) {
  typeof(T) value;
}

void main () {
  auto s = "some";
  s ~= "string";
  S!s value;
}


The side effect of this is the following error:

// Error: function literal __lambda3 (S!(s) a) is not
// callable using argument types (S!(s))

module program;

import std.stdio;

struct S (alias T) {
  typeof(T) value;
}

void f (alias l = x => 1) (string s) {
  l(S!(s).init);
}

void main () {
  auto s = "some";
  s ~= "string";
  f!((S!s a) { return 1; })(s);
}


I am not sure what the correct behavior should be, I think that the first code
should not compile. But if it should, and this is the correct behavior than the
error message should definitely be improved because.

-- 
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