www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20764] New: [The D Bug Tracker] std.traits.isAggregateType

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

          Issue ID: 20764
           Summary: [The D Bug Tracker] std.traits.isAggregateType chokes
                    on modules
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jl leroy.nyc

It seems that you can throw just about anything at isAggregateType, but not a
module:

module test;
import std.traits;
pragma(msg, isAggregateType!test);

t.d(3): Error: template instance `isAggregateType!(test)` does not match
template declaration `isAggregateType(T)`
t.d(3):        while evaluating `pragma(msg, isAggregateType!(test))`

Suggested fix: change the definition to:

enum isAggregateType(T...) =
  is(T[0] == struct) || is(T[0] == union) || is(T[0] == class)
  || is(T[0] == interface);

--
Apr 23