www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13732] New: Regular templates can use "template this", and

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

          Issue ID: 13732
           Summary: Regular templates can use "template this", and they
                    allow any type to be passed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: monkeyworks12 hotmail.com

template Test(this ThisType)
{
    pragma(msg, ThisType);
}

void main()
{
    alias T = Test!int; // Prints "int"
}

This will also work for class templates, struct templates, alias templates,
enum templates, etc., but not for templated methods. It doesn't matter if the
template is a free template or nested within a struct or class.

--
Nov 14 2014