Anonymous records with typedef names for linkage

Rafael Espíndola rafael.espindola at
Wed Jan 29 15:36:02 PST 2014

>> Can this go wrong in any non-delay-parsed context?
> ‘this’ is legal in some non-delay-parsed contexts, namely trailing result types.
> Do you have any objection to adopting my proposed diagnostic as a semi-temporary fix?  All the code it would affect currently triggers an assertion, and frankly it feels like a “real” fix here would require a pretty disproportionate amount of effort for the expected benefit.

BTW, I tried

template <typename T>
void f(T* x) {
template <typename T>
void g(T* x) {
typedef struct {
  void foo() {
} A;
void bar(A *x) {

with with gcc trunk. With c++03 it still produces an error and with
c++11 it produces an internal f and an external g.

For what it is worth, clang would probably be the most standard
complaint even with just the error.


More information about the cfe-commits mailing list