The most confusing error message

Ali Çehreli acehreli at yahoo.com
Wed Jan 24 18:29:58 UTC 2018


On 01/24/2018 05:36 AM, Jonathan M Davis wrote:

 > It's probably
 > a result of whatever code generating the error message being shared 
between
 > explicit templates and other sorts of templates where the template 
keyword
 > isn't used, and it doesn't handle the non-explicit templates very well.

It's more general than templates. Here are two quick cases with the same 
error message:

enum Color {
     Red
}

void main() {
     int i;
     i j;              // <-- Same error
     with (Color) {
         Red r;        // <-- Same error
     }
}

   Error: i is used as a type
   Error: Red is used as a type

Ali



More information about the Digitalmars-d mailing list