From: Rafael Espindola Date: Fri, 11 Mar 2011 04:56:58 +0000 (+0000) Subject: Fix PR9453 by not trying to print a warning about ignored qualifiers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e15394853bfae25112d9cc6b445504905e1f34a;p=clang Fix PR9453 by not trying to print a warning about ignored qualifiers in conversion functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127460 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index f161f4e623..2292735b50 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -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(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); diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp index 285fb09980..af7f50ce44 100644 --- a/test/SemaCXX/return.cpp +++ b/test/SemaCXX/return.cpp @@ -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 (); +};