[Issue 18698] New: static foreach + __traits(allMembers, moduleName)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 30 21:22:00 UTC 2018


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

          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 at puremagic.com
          Reporter: turkeyman at 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... :/

--


More information about the Digitalmars-d-bugs mailing list