return true;
// If the function is a class member, its signature includes the
- // cv-qualifiers (if any) on the function itself.
+ // cv-qualifiers (if any) and ref-qualifier (if any) on the function itself.
//
// As part of this, also check whether one of the member functions
// is static, in which case they are not overloads (C++
CXXMethodDecl* NewMethod = dyn_cast<CXXMethodDecl>(New);
if (OldMethod && NewMethod &&
!OldMethod->isStatic() && !NewMethod->isStatic() &&
- OldMethod->getTypeQualifiers() != NewMethod->getTypeQualifiers())
+ (OldMethod->getTypeQualifiers() != NewMethod->getTypeQualifiers() ||
+ OldMethod->getRefQualifier() != NewMethod->getRefQualifier()))
return true;
// The signatures match; this is not an overload.
--- /dev/null
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Member function declarations with the same name and the same
+// parameter-type-list as well as mem- ber function template
+// declarations with the same name, the same parameter-type-list, and
+// the same template parameter lists cannot be overloaded if any of
+// them, but not all, have a ref-qualifier (8.3.5).
+
+class Y {
+ void h() &;
+ void h() const &;
+ void h() &&;
+ void i() &;
+ void i() const; // FIXME: expected an error here!
+
+ template<typename T> void f(T*) &;
+ template<typename T> void f(T*) &&;
+
+ template<typename T> void g(T*) &;
+ template<typename T> void g(T*); // FIXME: expected an error here
+};