[PATCH] Fix treatment of types defined in function prototype

Serge Pavlov sepavloff at gmail.com
Wed Jun 25 10:30:36 PDT 2014


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

http://reviews.llvm.org/D4145






More information about the cfe-commits mailing list