public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27108]  New: syntax error with same-name typedef and local variable using va_arg
@ 2006-04-11  0:37 jesuswaffle at gmail dot com
  2006-04-11  1:06 ` [Bug c/27108] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: jesuswaffle at gmail dot com @ 2006-04-11  0:37 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/27108] syntax error with same-name typedef and local variable using va_arg
  2006-04-11  0:37 [Bug c/27108] New: syntax error with same-name typedef and local variable using va_arg jesuswaffle at gmail dot com
@ 2006-04-11  1:06 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-11  1:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-11 01:06 -------
This is not a bug as foo is now a variable decl and not a typedef one so "foo
a;" would fail also.

Now if this was C++ you could use ::foo to get the typedef version of foo but
this is C and there is no way to access the other namespaces.  

In 4.1.0 and above the error message is now:
t.c: In function 'pathological':
t.c:12: error: expected specifier-qualifier-list before 'foo'


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-11  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11  0:37 [Bug c/27108] New: syntax error with same-name typedef and local variable using va_arg jesuswaffle at gmail dot com
2006-04-11  1:06 ` [Bug c/27108] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).