public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 4.5 -> 4.6: user-unfriendly change in error message
@ 2011-05-15 22:30 Nathan Ridge
  2011-05-17  6:19 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Ridge @ 2011-05-15 22:30 UTC (permalink / raw)
  To: GCC Help Mailing List


Hello,
 
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?
 
Nate. 		 	   		  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 4.5 -> 4.6: user-unfriendly change in error message
  2011-05-15 22:30 4.5 -> 4.6: user-unfriendly change in error message Nathan Ridge
@ 2011-05-17  6:19 ` Ian Lance Taylor
  2011-05-23 12:15   ` Nathan Ridge
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-05-17  6:19 UTC (permalink / raw)
  To: Nathan Ridge; +Cc: GCC Help Mailing List

Nathan Ridge <zeratul976@hotmail.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: 4.5 -> 4.6: user-unfriendly change in error message
  2011-05-17  6:19 ` Ian Lance Taylor
@ 2011-05-23 12:15   ` Nathan Ridge
  0 siblings, 0 replies; 3+ messages in thread
From: Nathan Ridge @ 2011-05-23 12:15 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: GCC Help Mailing List


> From: iant@google.com
>
> Nathan Ridge 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

I have filed http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49117.
 
Regards,
Nate. 		 	   		  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-22 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-15 22:30 4.5 -> 4.6: user-unfriendly change in error message Nathan Ridge
2011-05-17  6:19 ` Ian Lance Taylor
2011-05-23 12:15   ` Nathan Ridge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).