Bug 159793 - ICPPFunction allows mutable functions
Summary: ICPPFunction allows mutable functions
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 15:47 EDT by Jason Montojo CLA
Modified: 2020-09-04 15:18 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Montojo CLA 2006-10-04 15:47:17 EDT
According to section 7.1.1.8 of the April 2003 draft of the ISO C++ standard (14882:2003), functions aren't allowed to have the storage class "mutable".

Although the grammar allows it, the standard says it can only be applied to names of non-const/non-static/non-reference data members.

However, ICPPFunction declares the method isMutable().

Are there any variants of C++ that allow mutable functions?  Or is it safe to take this out?
Comment 1 Doug Schaefer CLA 2006-10-04 15:55:22 EDT
The grammar is allowed to be permissive with what it accepts. However, you are correct, the IASTNodes/IBindings/ITypes should not. I'm not sure if this an oversight. The Niefer had the spec open beside him for the two years he worked on this stuff so he would know best why it's there.
Comment 2 Andrew Niefer CLA 2006-10-04 16:53:44 EDT
I confess that I didn't look particularily closely at the spec with regard to the mutable storage class specifier.  We don't have any semantic code that cares about it.

Jason is correct, mutable does not apply to functions.  And in fact, neither do register or auto which appear on IFunction. (I double checked the C spec as well for those two).  

The only variant that we made an effort to support is GCC, so I would expect these are safe to remove.

For reference sake, we used 14882:1998 for C++ and 9899:1999 for C.