]> granicus.if.org Git - clang/commitdiff
Fix PR9453 by not trying to print a warning about ignored qualifiers
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Mar 2011 04:56:58 +0000 (04:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 11 Mar 2011 04:56:58 +0000 (04:56 +0000)
in conversion functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127460 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/SemaCXX/return.cpp

index f161f4e6234789854b86d2a1507f697d362c1f54..2292735b50bdd6b31924b568abffac98c4db659a 100644 (file)
@@ -1757,6 +1757,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
       // cv-qualifiers on return types are pointless except when the type is a
       // class type in C++.
       if (isa<PointerType>(T) && T.getLocalCVRQualifiers() &&
+          (D.getName().getKind() != UnqualifiedId::IK_ConversionFunctionId) &&
           (!getLangOptions().CPlusPlus || !T->isDependentType())) {
         assert(chunkIndex + 1 < e && "No DeclaratorChunk for the return type?");
         DeclaratorChunk ReturnTypeChunk = D.getTypeObject(chunkIndex + 1);
index 285fb09980e6380c144fe950a5df874fd252a504..af7f50ce44b3e77c835d2b2f66c54df36b424958 100644 (file)
@@ -49,3 +49,7 @@ namespace PR9328 {
     const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
   };
 }
+
+class foo  {
+  operator int * const ();
+};