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


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.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


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