Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 160569)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -2067,6 +2067,8 @@
   "with parameter type}0,1 declared in a previous prototype">,
   InGroup<KNRPromotedParameter>;
 
+def err_invalid_qualified_function : Error<
+  "%0 cannot have cv-qualifiers">;
 
 // C++ Overloading Semantic Analysis.
 def err_ovl_diff_return_type : Error<
Index: include/clang/Sema/Sema.h
===================================================================
--- include/clang/Sema/Sema.h	(revision 160569)
+++ include/clang/Sema/Sema.h	(working copy)
@@ -1281,6 +1281,11 @@
   bool CheckFunctionDeclaration(Scope *S,
                                 FunctionDecl *NewFD, LookupResult &Previous,
                                 bool IsExplicitSpecialization);
+  
+  // Will emit a diagnostic if the given function has a prototype that declares
+  // cv-qualifiers.
+  bool DiagnoseIllegalQualifiers(const FunctionDecl *FnDecl);
+
   void CheckMain(FunctionDecl *FD, const DeclSpec &D);
   Decl *ActOnParamDeclarator(Scope *S, Declarator &D);
   ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC,
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp	(revision 160569)
+++ lib/Sema/SemaDeclCXX.cpp	(working copy)
@@ -9219,6 +9219,13 @@
     return SemaRef.Diag(FnDecl->getLocation(), InvalidParamTypeDiag)
     << FnDecl->getDeclName() << ExpectedFirstParamType;
   
+  // Check that the function does not have any cv-qualifiers (because the 
+  // operator is implicitly static even if not declared as such, and according 
+  // to [class.static.mfct]p2: "A static member function shall not be declared 
+  // const, volatile, or const volatile.
+  if (SemaRef.DiagnoseIllegalQualifiers(FnDecl))
+    return true;
+
   return false;
 }
 
@@ -11243,3 +11250,16 @@
 
   return false;
 }
+
+bool Sema::DiagnoseIllegalQualifiers(const FunctionDecl *FnDecl) {
+  const FunctionProtoType *Fn = FnDecl->getType()->getAs<FunctionProtoType>();
+  if (Fn && Fn->getTypeQuals() != 0)
+    // FIXME: it would be ideal to create a fixit to remove the cv-qualifiers
+    // from the declaration, but we do not track their location within the 
+    // declaration and so we can't make the source range to remove.  Also, we
+    // would have to apply the same fixit to the definition or else we would be
+    // creating another compile error (mismatched declaration & definition).
+    return Diag(FnDecl->getLocation(), diag::err_invalid_qualified_function)
+      << FnDecl->getDeclName();
+  return false;
+}
Index: test/SemaCXX/overloaded-operator.cpp
===================================================================
--- test/SemaCXX/overloaded-operator.cpp	(revision 160569)
+++ test/SemaCXX/overloaded-operator.cpp	(working copy)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 class X { };
 
 X operator+(X, X);
@@ -72,8 +72,8 @@
 
 void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2, Enum1 next_enum1) {
   float &f1 = (e1 == e2);
-  float &f2 = (enum1 == e2); 
-  float &f3 = (e1 == enum2); 
+  float &f2 = (enum1 == e2);
+  float &f3 = (e1 == enum2);
   float &f4 = (enum1 == next_enum1);  // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
 }
 
@@ -129,7 +129,7 @@
   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;
   long &lr = *cptr;
@@ -187,7 +187,7 @@
   int &ir2 = c2();
   int &ir3 = c2(1);
   double &fr2 = c2c();
-  
+
   int &ir4 = dc(17);
   double &fr3 = dc(3.14159f);
 }
@@ -265,13 +265,13 @@
 bool x(BB y, BB z) { return y != z; }
 
 
-struct AX { 
+struct AX {
   AX& operator ->();	 // expected-note {{declared here}}
   int b;
-}; 
+};
 
 void m() {
-  AX a; 
+  AX a;
   a->b = 0; // expected-error {{circular pointer delegation detected}}
 }
 
@@ -415,3 +415,14 @@
   void f(int);
   void g() { A x; x = f; }
 }
+
+namespace PR13481 {
+  struct A {
+    void *operator new(unsigned int) const { // expected-error {{'operator new' cannot have cv-qualifiers}}
+      return (void *)0;
+    }
+
+    void operator delete(void *) const { // expected-error {{'operator delete' cannot have cv-qualifiers}}
+    }
+  };
+}
