Nathan Ridge <zeratul976@xxxxxxxxxxx> writes: > Consider the following fragment of invalid code: > > struct A > { > struct B {}; > > int g(); > > B f() { return g(); } > }; > > GCC 4.5's error message is "error: conversion from 'int' to non-scalar type 'A::B' requested". > > GCC 4.6's error message is "error: could not convert 'A::g()' to 'A::B'". > > The 4.6 error message no longer mentions the actual type, int, that > cannot be converted to the declared return type, insteading mentioning > the expression yielding that type, A::g(). > > What is the rationale for this change? > > I think 4.5's error message is more useful because you can see from it > exactly what conversion (int to A::B) is failing. With 4.6's error message, > to find out why the conversion is failing you now have to look up the > return value of A::g() in your code. > > The difference becomes more pronounced with more complex examples. > For example, for the code in PR 49003, > > GCC 4.5: "error: conversion from 'vector::const_iterator' to non-scalar type 'vector::iterator' requested" > > GCC 4.6: "error: could not convert '((const block*)this)->block::v.vector::begin()' to 'vector::iterator'" > > Quite clearly, the 4.5 error message is better. > > Having said that, I think the phrasing of the 4.6 error is better, > so the best option would be: > > error: could not convert 'vector::const_iterator' to 'vector::iterator' > > Thoughts? Please file a bug report. See http://gcc.gnu.org/bugs/ . Thanks. Ian