Hi,

Attached is a patch that fixes PR5477 and PR5464
(http://llvm.org/bugs/show_bug.cgi?id=5477 ,
http://llvm.org/bugs/show_bug.cgi?id=5464).

The problem is ensuring tags and enum constants that are created as part of
a function prototype end up in the scope of the function definition, and
ensuring that they do not incorrectly conflict with identifiers in the
global scope. E.g.:

Const int AA = 5;
int f (enum {AA, BB} e) {
  Return AA;
}

Clang currently errors out: test.c:2:15: error: redefinition of 'AA'

The patch attached fixes this, and more complex examples such as:

struct a {
    struct b {
        int j;
    } b;
};

int foo(struct a { struct b { int j; } b; struct b { char glorx; } glorx; }
*);

It introduces some statefulness into Sema, but it appears that Sema is
already stateful so I hope that won't be a problem.

Could someone please review it? (some code taken from the current patch at
PR5464)

Cheers,

James
 

Attachment: enum_prototypes.diff
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to