www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18698] New: static foreach + __traits(allMembers, moduleName)


          Issue ID: 18698
           Summary: static foreach + __traits(allMembers, moduleName)
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

I just tried to write some code that I've been using for 10 years... but it's
not working today.

This works:
  module test;
  pragma(msg, __traits(allMembers, test));

Prints: tuple("object", "std", "numberOf", "arr", "t")

This should work, but doesn't:
  module test;
  static foreach(m; __traits(allMembers, test))
    pragma(msg, m);

Prints: Compiling C:\Code\blah.d failed!

Nice informative error ;)

I've been scanning the module for things since I started using D, but today, it
doesn't seem to work...

This is actually really serious. A huge amount of my compile-time machinery is
broken now! I can't serialise, or do any of my DLL machinery, dynamic language
bindings... :/

Mar 30 2018