[Issue 21839] New: Strange output at Compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 17 16:59:39 UTC 2021


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

          Issue ID: 21839
           Summary: Strange output at Compile time
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mensikovk817 at gmail.com

import std.stdio;

alias Sample = inter!q{
  void sample();
};

void main(){}

template inter(string a){
  enum inter = {
      struct Dummy{mixin(a);}
      foreach(member_name; __traits(allMembers, Dummy)){
        if(member_name != `this`){
          pragma(msg, "WHYYYY ", member_name != `this`);
        }
      }
      return 0;
    }();
}

output: 
WHYYYY true
WHYYYY false

version: DMD32 D Compiler v2.096.0-dirty

--


More information about the Digitalmars-d-bugs mailing list