This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix PR c++/29024


Hi,

This bug is an accepts valid where the presence of a storage class
specifier in a typedef declaration wasn't being diagnosed. The
testcase taken from the PR is:

typedef static int a;

which with current mainline is silently accepted. Whilst looking at
this I noticed the following two testcases are accepted when they
should be rejected:

typedef register int b;
typedef extern int c;

The proposed fix if to add a check in cp_parser_set_storage_class to
see if a typedef specifier is already present on the input decl_specs
and to set multiple_storage_classes_p to true if there is. This is
then picked up in grokdeclarator which will issue the relevant error
message.

Bootstrapped and regression tested with no new failures on
i686-pc-linux-gnu. Ok for mainline and 4.1/4.0 branches?

Cheers,
Lee.

:ADDPATCH c++:

2006-09-23 Lee Millward <lee.millward@codesourcery.com>

       PR c++/29024
       * parser.c (cp_parser_set_storage_class): Set
       multiple_storage_classes_p for the input decl
       specifier if a typedef specifier is present.

2006-09-23 Lee Millward <lee.millward@codesourcery.com>

       PR c++/29024
       * g++.dg/parse/typedef8.C: New test.

Attachment: pr29024.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]