-std=c89 doesn't warn about gcc's "?:" extension

Environment:
System: Linux rho 2.6.15-1-amd64-k8 #2 Tue Mar 7 06:53:26 UTC 2006 x86_64
GNU/Linux
Architecture: x86_64


host: x86_64-unknown-linux-gnu
build: x86_64-unknown-linux-gnu
target: x86_64-unknown-linux-gnu
configured with: /mirror/d/gcc/configure --disable-nls
--prefix=/p/p/gcc-2006-06-29.18h54 --disable-multilib --enable-languages=c

How-To-Repeat:

For example, I expected this to fail:

  echo 'int main() { return 3 ?: 1; }' > k.c
  gcc -W -Wall -std=c89 k.c

With --pedantic, I do get a warning:

  $ gcc --pedantic -std=c89 k.c
  k.c: In function 'main':
  k.c:1: warning: ISO C forbids omitting the middle term of a ?: expression

I suppose that using -std=c99 should evoke a warning, too.


-- 
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jim at meyering dot net
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28368

Reply via email to