[cfe-dev] clang rejects nested struct-member-access-typeof

Matthieu Monrocq matthieu.monrocq at gmail.com
Wed Nov 2 13:10:44 PDT 2011


Le 2 novembre 2011 14:01, Jan Engelhardt <jengelh at medozas.de> a écrit :

>
> On Wednesday 2011-11-02 04:51, Douglas Gregor wrote:
> >>      void *p = 0;
> >>      typeof((struct { typeof((struct { void *m; }){p}.m) n; }){0}.n) q
> = 0;
> >
> >This code is relying on GCC extensions to treat a compound literal
> >as a constant expression, which C99 forbids.
>
> I do not think this should have anything to do with constexprs, also
> because typeof does not really evaluate its argument, but just looks
> at the type system. Clang accepts a handful of - what looks to me
> like non-constant expressions - to typeof:
>
>        typeof((struct { void *m; }){p}.m) q = 0;
>
>        typeof(argc) argc2 = argc;
>
> >Feel free to file a bug; this might be the kind of thing that we can
> >support for GNU compatibility, if it falls out of the constexpr and
> >other C++11 work in this area.
>
> I guess I did by writing to this list.
>
>
Hello Jan,

To file a bug you need to visit: http://llvm.org/bugs/

On top of your description of the problem you are expected to provide a
minimal example that reproduces the issue. If you cannot produce this
minimal example, a preprocessed file can suffice (use -E to get the
preprocessor output) however it might make investigation harder (and thus
delay the correction).

--Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111102/c2ee71b9/attachment.html>


More information about the cfe-dev mailing list