for fun, if questionable - a heisenbug

captaindet 2krnk at gmx.net
Tue Apr 8 13:11:44 PDT 2014


reported as part of issue 12541
https://d.puremagic.com/issues/show_bug.cgi?id=12541

=== CODE ===

module heisenbug;

//  pragma(msg, __traits(compiles, test) );
// comment in the pragma and 'enum buggy' below will compile fine

enum buggy = valid!(test);
// Error: variable heisenbug.buggy had semantic errors when compiling
pragma(msg, "buggy = "~buggy.stringof);

enum test = 13;

template valid(alias sym){
     enum valid = __traits(compiles, sym);
} // no difference if this template is declared first

void main(){}


More information about the Digitalmars-d mailing list