On several different version of gcc (2.95, 3.3 and 3.4)
(gcc-3.4 --version reports: gcc-3.4 (GCC) 3.4.2 (Debian 3.4.2-2))
When I compile a.c I get errors:

a.c:6: error: parse error before "c"
etc

but b.c compiles without errors. As I understand the ANSI-C standard,
type names and variable names should be separate namespaces - and both
programs should compile (borland turbo C 2.01 compiles both programs).

==> a.c <==
#include <stdio.h>

typedef int i;
typedef char c;

i main (i c, c ** v)
{
  i i=1;
  printf("%d\n",c+i);
  return 0;
}

==> b.c <==
#include <stdio.h>

typedef int i;
typedef char c;

i main (i C, c ** v)
{
  i i=1;
  printf("%d\n" C+i);
  return 0;
}

-- 
           Summary: name clash in C?
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jacob at engelbrecht dot dk
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to