This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC rejecting (I think) valid code
- From: Andreas Schwab <schwab at suse dot de>
- To: "Sam Lauber" <sam124 at operamail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 23 Jan 2005 15:05:03 +0100
- Subject: Re: GCC rejecting (I think) valid code
- References: <20050122215821.328913982EF@ws5-1.us4.outblaze.com>
"Sam Lauber" <sam124@operamail.com> writes:
> I compile this pair of declarations with GCC (which would
> probably be found in a stdint.h):
>
> typedef short int16_t;
> typedef unsigned int16_t uint16_t;
>
> The first declaration is OK, but GCC gives me an error on
> the second one. That dosen't make sense, because part of
> the C89 grammar is
>
> type-name:
> (some types) typedef-name
>
> typedef-declaration: something like
> `typedef' type-name typedef-name
There is more to C than the syntax. The standard also contains semantic
constraints that are to be applied on top of the syntax. I can't check
C89, but in C99 section 6.7.2 contains an exhaustive list of allowed
type-specifier sets in a type-name, and this list only allows a single
typedef-name not mixed with other type-specifiers for each type-name.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."