An example of Clang error messages

Walter Bright newshound1 at digitalmars.com
Fri Mar 5 10:26:57 PST 2010


Marianne Gagnon wrote:
> I am not familiar with the error messages given by DMC; in my own
> experience, I found that feature useful when e.g. you have something
> like
> 
> x = (a + b) * (c + d) / (e + f);
> 
> and you have error message "invalid operands to +" or so. Then
> 
> x = (a + b) * (c + d) / (e + f); ^
> 
> helps. Of course, a better error message saying "variable 'c' of type
> 'Foo' cannot be used as operand to +" works too

Here's what DMC does:

     x = (a + b) * (c + d) / (e + f);
                         ^
test.cpp(6) : Error: illegal operand types
Had: Foo
and: int

and here's what DMD does:

test.d(6): Error: incompatible types for ((c) + (d)): 'Foo' and 'int'




More information about the Digitalmars-d mailing list