www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12651] New: TemplateArgsOf accepts nonsensical arguments


          Issue ID: 12651
           Summary: TemplateArgsOf accepts nonsensical arguments
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: andrej.mitrovich gmail.com
                CC: k.hara.pg gmail.com

import std.traits;

struct S(T)

void main()
    // compiles, but makes no sense
    pragma(msg, TemplateArgsOf!(S!int, S, float));

I'm not sure whether this could also be a compiler bug. I'll CC kenji. The
following is the reduced test-case:

alias TemplateArgsOf(alias T : Base!Args, alias Base, Args...) = Args;

struct S(T) { }

void main()
    pragma(msg, TemplateArgsOf!(S!int, S, float));  // prints 'int'

Apr 26 2014