This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++,PATCH,RFC] Error message improvement.


Because one g++ error message about conditional expression is rather
concise, I had quite some trouble to find an error (I looked in a non
related place). The problem is when the two expressions (not the test)
of a ?: are of different types. In this case, g++ just gives

error: operands to ?: have different types

which is rather uninformative about the types.

The simple patch improves the error message. I have checked that it
compiles and that the error message is indeed improved. I have to work
slightly more to create a testcase and to check that the testsuite needs
no modifications (and it will not be before next monday). But here it is
for comments...

	Theo.

cp/ChangeLog:

2005-07-13  ThÃodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
    * call.c (build_conditional_expr): Print types in error messages.

	
Index: gcc/cp/call.c
===================================================================
RCS file: /user/papadop/home/src/Cvs/Refs/gcc/gcc-
cvs/gcc/gcc/cp/call.c,v
retrieving revision 1.543
diff -r1.543 call.c
3241c3241,3242
<     error ("operands to ?: have different types");
---
>     error ("operands to ?: have different types %qT and %qT",
>              arg2_type, arg3_type);
3451c3452,3453
<       error ("operands to ?: have different types");
---
>     error ("operands to ?: have different types %qT and %qT",
>              arg2_type, arg3_type);



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]