[Issue 12651] New: TemplateArgsOf accepts nonsensical arguments
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Apr 26 02:07:14 PDT 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=12651
          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 at puremagic.com
          Reporter: andrej.mitrovich at gmail.com
                CC: k.hara.pg at 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'
}
-----
--
    
    
More information about the Digitalmars-d-bugs
mailing list