[cfe-dev] How can I use the result of a void expression? :p
Keith Bauer
onesadcookie at gmail.com
Sun Aug 26 04:49:09 PDT 2007
Here's a patch for this.
-Keith
On 8/26/07, Keith Bauer <onesadcookie at gmail.com> wrote:
> imac:Desktop keith$ cat > conditionalvoid.c
> extern void foo();
> extern void bar();
> void baz(int c) {
> c ? foo() : bar();
> }
> imac:Desktop keith$ gcc -fsyntax-only -Wall -Wextra conditionalvoid.c
> imac:Desktop keith$ clang -fsyntax-only conditionalvoid.c
> conditionalvoid.c:4:3: warning: expression result unused
> c ? foo() : bar();
> ^~~~~~~~~~~~~~~~~
> 1 diagnostic generated.
>
> ( ?: on void is perfectly legal according to C99 6.5.15 )
>
> -Keith
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cond-side-effect.diff
Type: application/octet-stream
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20070826/24a7c4c7/attachment.obj>
More information about the cfe-dev
mailing list