forked from OSchip/llvm-project
Fix overloading of non-static member functions that differ in their cv-qualifiers
llvm-svn: 59819
This commit is contained in:
parent
9eb16eadfb
commit
b81897cda6
|
@ -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.
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue