This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1571: g++ is confused with by code that typedef's wchar_t.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1571: g++ is confused with by code that typedef's wchar_t.
- From: cgd at sibyte dot com
- Date: 6 Jan 2001 01:37:55 -0000
- Cc: cgd at sibyte dot com, don at pixstream dot com
- Reply-To: cgd at sibyte dot com
>Number: 1571
>Category: c++
>Synopsis: g++ is confused with by code that typedef's wchar_t.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 05 17:46:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: cgd@sibyte.com (Chris Demetriou)
>Release: gcc version 2.97 20010102 (experimental), and thereabouts.
>Organization:
>Environment:
gcc version 2.97 20010102 (experimental) on sparc-solaris native,
gcc version 2.97 20010102 (experimental) on sparc-solaris targetting mips-elf,
gcc version 2.97 20010103 (experimental) on the codesourcery gcc test web page at http://www.codesourcery.com/gcc-compile.shtml.
>Description:
g++ seems to to mishandle code which typedef's wchar_t,
emitting an error when none is appropriate.
in particular, code like:
typedef int wchar_t;
when compiled with g++ produces an error like:
foo.cc:1: declaration does not declare anything
This problem was also reported in the message:
http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00516.html
(that message includes an indication of where the problem
was likely introduced, but I did not attempt to verify it).
I ran into it on my own, compiling NetBSD code.
(Several of NetBSD's headers typedef wchar_t as
appropriate.)
>How-To-Repeat:
cat > foo.cc << __EOF__
typedef int wchar_t;
__EOF__
g++ foo.cc
notice the error message:
foo.cc:1: declaration does not declare anything
>Fix:
Unknown. I couldn't find a workaround, either. (I tried
-ffreestanding, -fno-builtin... didn't know what else
to try. Apparent lack of workaround might make it
reasonable to mark this bug critical, but I wasn't sure,
so i only made it "serious.")
>Release-Note:
>Audit-Trail:
>Unformatted: