[cfe-dev] C++: Reference to member in sizeof expression of another member declaration

Rafael Espíndola rafael.espindola at gmail.com
Sun May 12 16:31:00 PDT 2013


Could you please report a bug for this one too?

On 12 May 2013 04:18, Florian Weimer <fweimer at redhat.com> wrote:
> clang++ (trunk, both C++03 and C++11 modes) rejects the following program:
>
> union u {
>   int a;
>   char b[sizeof(a)];
> };
>
> t.cpp:3:17: error: invalid use of non-static data member 'a'
>   char b[sizeof(a)];
>                 ^
>
> This seems valid C++, considering this language in [expr.prim.general]: "An
> id-expression that denotes a non-static data member […] can only be used […]
> if that id-expression […] appears in an unevaluated operand"
>
> --
> Florian Weimer / Red Hat Product Security Team
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list