http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49152
--- Comment #28 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-01 13:23:01 UTC --- (In reply to comment #27) > (In reply to comment #26) > > because if you want nice diagnostics, why don't just use > > Clang? > > Because G++ gives much better diagnostics for template argument deduction > failures, so "just use clang" isn't a solution even if all you care about is > better diagnostics. I am talking about the perspective of a new contributor that starts from zero knowledge in both Clang and GCC. Then, it looks easier and it is in fact much less effort to fix Clang to give the same diagnostics as g++ for template argument deduction than to add caret diagnostics to GCC. But my main point is that it is not a matter of effort: Even if g++ indeed gives better diagnostics in some cases, this is either recognized as a bug in Clang that can be fixed or it is a matter of opinion (more information versus conciseness, assume users know the language standard terminology vs. use less precise but more widely understandable language). On the other hand, the current status is that the output of G++ is broken "by design" and no patches will be accepted to change the design. Quoting http://clang.llvm.org/diagnostics.html: No Pretty Printing of Expressions in Diagnostics Since Clang has range highlighting, it never needs to pretty print your code back out to you. GCC can produce inscrutible error messages in some cases when it tries to do this. In this example P and Q have type "int*": $ gcc-4.2 -fsyntax-only t.c #'exact_div_expr' not supported by pp_c_expression#'t.c:12: error: called object is not a function $ clang -fsyntax-only t.c t.c:12:8: error: called object type 'int' is not a function or function pointer (P-Q)(); ~~~~~^ This can be particularly bad in G++ which often emits errors containing lowered vtable references: $ gcc-4.2 t.cc t.cc: In function 'void test(foo*)': t.cc:9: error: no match for 'operator+' in '(((a*)P) + (*(long int*)(P->foo::<anonymous>.a::_vptr$a + -0x00000000000000020)))->a::bar() + * P' t.cc:9: error: return-statement with a value, in function returning 'void' $ clang t.cc t.cc:9:18: error: invalid operands to binary expression ('int' and 'foo') return P->bar() + *P; ~~~~~~~~ ^ ~~