[Issue 15719] New: Can't make template with name "this"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 24 03:12:17 PST 2016


https://issues.dlang.org/show_bug.cgi?id=15719

          Issue ID: 15719
           Summary: Can't make template with name "this"
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: lasssafin at gmail.com

You can't have a template inside an aggregate with the name "this".
This prevents one from creating an advanced function template.

This works:

struct S {
    this(int i)(float f) {}
}

This doesn't:

struct S {
    template this(int i) {
        this(float f) {}
    }
}

--


More information about the Digitalmars-d-bugs mailing list