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]

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


: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'

Bootstrapped and regression tested with --enable-languages=all on
i686-pc-linux-gnu.

OK for mainline?

2007-01-31 Manuel Lopez-Ibanez <manu@gcc.gnu.org>

 PR c++/28943
cp/
 * call.c (build_conditional_expr): Improve error message.
testsuite/
 * g++.dg/warn/pr28943.C: New.

Attachment: void-nonvoid-in-conditional.diff
Description: Text document


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