[cfe-dev] Member expression returns type with wrong qualifiers
    Eli Friedman 
    eli.friedman at gmail.com
       
    Mon Feb  4 15:59:51 PST 2008
    
    
  
On Feb 4, 2008 3:06 PM, Steve Naroff <snaroff at apple.com> wrote:
> One solution is to extend Expr::isModifiableLvalue() and the
> MemberExpr AST to return the underlying base type.
That might fix this exact case, but it's not a general fix.  Try
something like the following:
int a(const struct {int a;} * x) {
int* y = &x->a;
*y = 10;
}
(Note that we actually allow this for gcc compat, but the -pedantic
warning that should show up doesn't show up.)
Or the following:
int a(volatile struct {int a;} * x) {
x->a = 10;
}
Which will silently generate wrong code because it throws out the
volatile qualifier.
Pretty much anything that depends on qualifiers would require an
independent fix for this issue, which seems like a bad idea.
-Eli
    
    
More information about the cfe-dev
mailing list