When compiling this (after cpp):

# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
# 1 "/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 105 "/usr/lib/gcc/i686-pc-linux-gnu/3.4.4/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 2 "test.c" 2

typedef int foo;

pathological(int a, ...) {
  int foo;
  va_list ap;

  __builtin_va_arg(ap,foo);
}

I get this error:

test.c: In function `pathological':
test.c:9: error: parse error before "foo"

Removing the 'int foo' declaration in 'pathological' fixes the error. I'm not
sure what to make of this; however, I would suspect that the variable named foo
is preventing gcc from seeing the typedef named foo.


-- 
           Summary: syntax error with same-name typedef and local variable
                    using va_arg
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jesuswaffle at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to