[cfe-dev] Member expression returns type with wrong qualifiers

Eli Friedman eli.friedman at gmail.com
Mon Feb 4 12:15:44 PST 2008


As I mentioned before, the following:
int a(const struct {int a;}*b) {b->a = 10;}
is incorrectly accepted by clang.  (Relevant spec reference: C99 6.5.2.3p3.)

I'm not completely sure how to go about fixing this, though.  It could
be fixed completely in the MemberExpr constructor, but that would be
burying spec rules inside Expr.h, which seems wrong.  (Not to mention
it would be extremely ugly.)  On the other hand, if the logic isn't in
the constructor, serialization also needs to be able to figure out the
type of the MemberExpr. Maybe some sort of helper would be best?

-Eli



More information about the cfe-dev mailing list