[PATCH] D37089: [Sema] Error out early for tags defined inside an enumeration.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 11:21:20 PDT 2017


On Wed, Sep 20, 2017 at 2:17 PM, Volodymyr Sapsai via Phabricator via
cfe-commits <cfe-commits at lists.llvm.org> wrote:
> vsapsai added a comment.
>
> Thanks for following up, Alberto. I haven't expected such a use case. It is possible to achieve the same with `LSA_SIZEOF_SA = sizeof(((len_and_sockaddr *)0)->u)` but I don't like it and don't want to force developers using such approach.
>
> For solving this problem I think to restrict error only to C++ and to allow tags inside enums for C. Alberto, what do you think, will it work for you? And from implementation perspective allowing tags in enums for C should be safe because things go haywire for C++ while checking access rules and C doesn't have access rules.

That construct is well-formed C code, but isn't in C++ (C++ restricts
the places where you can define a new type compared to what C allows).

~Aaron

>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D37089
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list