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]

Re: PATCH RFA: -Wc++-compat warn about typedef/tag conflict


On Fri, May 15, 2009 at 1:52 PM, Ian Lance Taylor <iant@google.com> wrote:
> In C, struct, union and enum tags occupy a distinct name space. ?In C++,
> these tags are in the same name space as typedef names. ?C++ permits an
> explicit typedef of a tag to the associated type. ?However, it does not
> permit the same name to be used as a tag and a typedef of some other
> type. ?In particular, this is invalid in C++:
> ? ?typedef struct mystruct *mystruct;
>
> The first patch in this message improves -Wc++-compat to warn about
> these cases. ?This patch requires approval from the C frontend
> maintainers.
>
> The second patch in this message fixes the gcc source code so that
> bootstrap succeeds. ?This mechanical patch requires approval from the
> C++ and libcpp maintainers.

OK.

I was wondering whether it would not be simpler to move
the typedef


typedef struct convert_optab_d *convert_optab;

before the definition of convert_optab_d so that you just
use convert_optab as opposed to the more convoluted/verbose

    struct convert_optab_d *

in function parameters.


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