[PATCH] Fix treatment of types defined in function prototype

Richard Smith richard at metafoo.co.uk
Wed Jun 25 12:33:17 PDT 2014


That seems fine. I just wanted to be sure it didn't crash.
On 25 Jun 2014 18:30, "Serge Pavlov" <sepavloff at gmail.com> wrote:

> Thank you for review.
>
>
> 2014-06-24 23:24 GMT+07:00 Richard Smith <richard at metafoo.co.uk>:
>
>> LGTM
>>
>> ================
>> Comment at: test/SemaCXX/type-definition-in-specifier.cpp:44
>> @@ +43,3 @@
>> +  void func4(struct t19018 {int qq;} x);  // expected-error{{cannot be
>> defined in a parameter type}}
>> +  void func5(struct {int qq;} x); // expected-error{{cannot be defined
>> in a parameter type}}
>> +};
>> ----------------
>> Does this still work if you put something more complex into the struct
>> definition? (For instance, if it tries to reference a member of the
>> surrounding struct, or if it has member functions, or similar.)
>>
> It still works, corresponding testcases are added. However, access to a
> member of the surrounding struct is resolved as for nested types, the code:
>
> struct aaa {
>   int xx;
>   void func5(struct { int qq() { return xx; }; } x);
> };
>
>
> produces also a message:
>
> error: use of non-static data member 'xx' of 'aaa' from nested type ''
>
>
> I don't know if this behavior need to be fixed, as type defined in
> prototype itself is erroneous.
>
> Thanks,
> --Serge
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140625/bf656219/attachment.html>


More information about the cfe-commits mailing list