Bug 160335 - ICPPFunctionType allows non-member const/volatile functions
Summary: ICPPFunctionType allows non-member const/volatile 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-10 11:50 EDT by Jason Montojo CLA
Modified: 2020-09-04 15:23 EDT (History)
1 user (show)

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-10 11:50:58 EDT
According to the ISO C++ standard (ISO/IEC 14882:2003), non-static member functions can have a CV qualifier (e.g. const, volatile, or const volatile).

ICPPFunctionType, which applies to both member and non-member functions, declares isConst() and isVolatile(), but these two methods should really go into ICPPMethod since they don't apply to non-member functions.
Comment 1 Andrew Niefer CLA 2006-10-10 13:08:21 EDT
Unlike mutable, this does affect semantic resolution.  
Methods can be overloaded solely based on this cv-qualifier (it affects the type of the implicit this parameter).  Functions/Methods are compared based on type. 

I think that the isConst/isVolatile will need to stay in the IType instead of moving to ICPPMethod.  I would suggest something like ICPPMethodType to extend ICPPFunctionType.  Obviously callers of isConst will need to be updated for this change, particularily we will need to make sure IType.isSameType works correctly