www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21839] New: Strange output at Compile time

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 puremagic.com
          Reporter: mensikovk817 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

--
Apr 17 2021