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

Eli Friedman eli.friedman at gmail.com
Wed Nov 2 14:13:36 PDT 2011


On Wed, Nov 2, 2011 at 1:55 PM, Jan Engelhardt <jengelh at medozas.de> wrote:
> On Wednesday 2011-11-02 21:10, Matthieu Monrocq wrote:
>
>>
>>
>>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).
>
> According to http://clang.llvm.org/get_involved.html , cfe-dev is (also)
> for bugs.
> Minimal test case has already been provided.

Entered into the bug database (http://llvm.org/bugs/show_bug.cgi?id=11299).

-Eli




More information about the cfe-dev mailing list