r184466 - Clean up warning and add a test.

Eli Friedman eli.friedman at gmail.com
Thu Jun 20 13:58:02 PDT 2013


Author: efriedma
Date: Thu Jun 20 15:58:02 2013
New Revision: 184466

URL: http://llvm.org/viewvc/llvm-project?rev=184466&view=rev
Log:
Clean up warning and add a test.


Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaCXX/conversion-function.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=184466&r1=184465&r2=184466&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jun 20 15:58:02 2013
@@ -6032,8 +6032,8 @@ void Sema::CheckConversionDeclarator(Dec
   if (SC == SC_Static) {
     if (!D.isInvalidType())
       Diag(D.getIdentifierLoc(), diag::err_conv_function_not_member)
-        << "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc())
-        << SourceRange(D.getIdentifierLoc());
+        << SourceRange(D.getDeclSpec().getStorageClassSpecLoc())
+        << D.getName().getSourceRange();
     D.setInvalidType();
     SC = SC_None;
   }

Modified: cfe/trunk/test/SemaCXX/conversion-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion-function.cpp?rev=184466&r1=184465&r2=184466&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/conversion-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion-function.cpp Thu Jun 20 15:58:02 2013
@@ -11,6 +11,8 @@ public:
   float g() {
     return operator float(); // expected-error{{use of undeclared 'operator float'}}
   }
+
+  static operator short(); // expected-error{{conversion function must be a non-static member function}}
 };
 
 operator int(); // expected-error{{conversion function must be a non-static member function}}





More information about the cfe-commits mailing list