[Issue 12262] New: regression(2.065): isTemplateInstantiation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 25 23:09:23 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12262

           Summary: regression(2.065): isTemplateInstantiation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timothee.cour2 at gmail.com


--- Comment #0 from Timothee Cour <timothee.cour2 at gmail.com> 2014-02-25 23:09:20 PST ---
See below (CT error); is that related to issue 12261 ?

version(unittest){
  struct A1(T){}
  struct A2{}
  template A3(T){
    struct A{}
  }
  struct A4(alias fun,T...){}
}

template GetTemplateParent(T : TI!TP, alias TI, TP...)
{
  alias GetTemplateParent = TI;
}
template GetTemplateParent(alias T : TI!TP, alias TI, TP...)
{
  //TODO: how come this doesn't work with functions?
  alias GetTemplateParent = TI;
}

template isTemplateInstantiation(T...) if(T.length==1)
{
  enum isTemplateInstantiation=is(typeof(GetTemplateParent!T));
}
unittest
{
  static assert(isTemplateInstantiation!(A1!double));
  static assert(!isTemplateInstantiation!(A1));
  static assert(!isTemplateInstantiation!(A2));
  static assert(!isTemplateInstantiation!(A3));
  static assert(isTemplateInstantiation!(A3!double));
  static assert(!isTemplateInstantiation!(A3!double.A)); //CT error
  static assert(!isTemplateInstantiation!(int));
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list