This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR28943 Unusable error message when using a conditional-expression with multiple type arguments
- From: Basile STARYNKEVITCH <basile at starynkevitch dot net>
- To: Manuel L?pez-Ib??ez <lopezibanez at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Jan 2007 10:49:36 +0100
- Subject: Re: PR28943 Unusable error message when using a conditional-expression with multiple type arguments
- References: <6c33472e0701310142i7cd71295r3f83f4169c7b9ed0@mail.gmail.com>
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} ***