On Nov 17, 2008, at 3:12 PM, Sebastian Redl wrote:

> Chris Lattner wrote:
>>
>> On Nov 14, 2008, at 3:42 PM, Sebastian Redl wrote:
>>
>>> +    case DeclSpec::SCS_mutable:
>>> +      // mutable can only appear on non-static class members, so  
>>> it's always
>>> +      // an error here
>>> +      Diag(D.getIdentifierLoc(), diag::err_mutable_nonmember);
>>> +      InvalidDecl = true;
>>> +    }
>>
>> Please use an explicit break here, even though it isn't strictly  
>> needed.
> Of course. I'd never intentionally omit a break.
>>> +    case DeclSpec::SCS_mutable:
>>> +      if (isFunc) {
>>> +        if (DS.getStorageClassSpecLoc().isValid())
>>> +          Diag(DS.getStorageClassSpecLoc(),
>>> +               diag::err_mutable_function);
>>> +        else
>>> +          Diag(DS.getThreadSpecLoc(),
>>> +               diag::err_mutable_function);
>>> +        D.getMutableDeclSpec().ClearStorageClassSpecs();
>>
>> How does this work for things like:
>>
>>  mutable int Y(), X;
>> or:
>>  mutable int &Y, X;
>>
>> I guess it isn't the end of the world :), but it seems that it  
>> could cause spurious diagnostics in these cases by removing  
>> mutability from X.  Is it possible to recover by eliminating  
>> mutable from just Y?
> Yes, but at some effort. We would have to set a flag here and pass  
> it along to the function that actually creates the CXXFieldDecl  
> (ActOnField), so that it can ignore the mutable storage class.
> ActOnField, however, is a method of Action, so we shouldn't just add  
> a parameter to it that is an implementation detail of Sema. So we'd  
> have to create a new function that has this parameter and make  
> ActOnField a thin wrapper around it.
>
> I'll add a FIXME for now. I can do this I have some time with  
> nothing better to do.

Ok, seems fine with me.  Thanks Sebastian!

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

Reply via email to