/++
if a forward referenced symbol is first used as template parameter, then
compilation fails for symbols that represent values.
(no problems with symbols representing funcs, structs, classes and empty enums.)
++/
//any of the following will make the bug(s) disappear:
// enum fix = test;
// enum fix2 = test2;
// pragma(msg, __traits(compiles, test) );
// pragma(msg, __traits(compiles, test2) );
enum buggy = check!(test);
enum buggy2 = check2!(test2);
//Error: variable buggy(2) had semantic errors when compiling
enum test = 13; // fails
enum test2 = 13; // fails
// immutable test = 13;// fails
// const test = 13; // fails
//BUT no problems whatsover with symbols not representing values:
// enum test; // works
// void test(){} // works
// struct test{} // works
// class test{} // works
template check(alias sym){
enum check = true;
} // no difference if this template is declared first
template check2(int sym){
enum check2 = true;
} // no difference if this template is declared first
void main(){}
Comment #1 by 2krnk — 2014-04-09T18:49:15Z
*** Issue 12541 has been marked as a duplicate of this issue. ***
Comment #2 by 2krnk — 2014-04-09T18:54:30Z
*** Issue 10075 has been marked as a duplicate of this issue. ***
Comment #3 by 2krnk — 2016-07-18T04:46:09Z
this issue seems to be fixed in DMD 2.071.1. example code now compiles w/o errors.