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]

Re: PR28943 Unusable error message when using a conditional-expression with multiple type arguments


On 31/01/07, Basile STARYNKEVITCH <basile@starynkevitch.net> wrote:
Le Wed, Jan 31, 2007 at 09:42:33AM +0000, Manuel L?pez-Ib??ez écrivait/wrote:
> :ADDPATCH c++:
>
> The error message for this code:
>
> void debug (const char * string)
> {
>  return;
> }
>
> int f()
> {
>  ( true == false ? 0 : debug ("Some string"));
>  return 0;
> }
>
> is:
>
> error: debug(((const char*)"Some string")) has type void and is not a
> throw-expression
>
> The following patch changes the message to:
>
> error: 'debug(((const char*)"Some string"))' of type 'void' is
> incompatible with '0' of type 'int'

I'm not in position to approve patches, but I would suggest that the warning
still talk about throw. Because if debug throwed some exception, the
original code could have some sense.

Maybe it could say

  error: 'debug(((const char*)"Some string"))' of type 'void' is
  incompatible with '0' of type 'int' and is not a throw-expression

But I don't have enough C++ practice to really know when such an error is
meaningful in the real world.

I don't care one way or another, just trying to keep it short. Whatever the reviewer says, I will implement.

Thanks for looking at this,

Manuel.


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