Fix overloading of non-static member functions that differ in their cv-qualifiers

llvm-svn: 59819
This commit is contained in:
Douglas Gregor 2008-11-21 15:36:28 +00:00
parent 9eb16eadfb
commit b81897cda6
3 changed files with 7 additions and 7 deletions

View File

@ -326,7 +326,7 @@ Sema::IsOverload(FunctionDecl *New, Decl* OldD,
CXXMethodDecl* NewMethod = dyn_cast<CXXMethodDecl>(New);
if (OldMethod && NewMethod &&
!OldMethod->isStatic() && !NewMethod->isStatic() &&
OldQType.getCVRQualifiers() != NewQType.getCVRQualifiers())
OldMethod->getTypeQualifiers() != NewMethod->getTypeQualifiers())
return true;
// The signatures match; this is not an overload.

View File

@ -16,9 +16,7 @@ int g(); // expected-error {{error: functions that differ only in their return t
class X {
void f();
void f(int);
// FIXME: can't test this until we can handle const methods.
// void f() const;
void f() const;
void g(int); // expected-error {{error: previous declaration is here}}
void g(int, float); // expected-error {{error: previous declaration is here}}

View File

@ -90,12 +90,14 @@ void incdec_test(PostInc pi, PostDec pd) {
struct SmartPtr {
int& operator*();
// FIXME: spurious error: long& operator*() const;
long& operator*() const volatile;
};
void test_smartptr(SmartPtr ptr, const SmartPtr cptr) {
void test_smartptr(SmartPtr ptr, const SmartPtr cptr,
const volatile SmartPtr cvptr) {
int &ir = *ptr;
// FIXME: reinstate long &lr = *cptr;
long &lr = *cptr;
long &lr2 = *cvptr;
}