[cfe-commits] r127460 - in /cfe/trunk: lib/Sema/SemaType.cpp test/SemaCXX/return.cpp

Eli Friedman eli.friedman at gmail.com
Thu Mar 10 21:27:56 PST 2011


On Thu, Mar 10, 2011 at 11:56 PM, Rafael Espindola
<rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Thu Mar 10 22:56:58 2011
> New Revision: 127460
>
> URL: http://llvm.org/viewvc/llvm-project?rev=127460&view=rev
> Log:
> Fix PR9453 by not trying to print a warning about ignored qualifiers
> in conversion functions.
>
> Modified:
>    cfe/trunk/lib/Sema/SemaType.cpp
>    cfe/trunk/test/SemaCXX/return.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=127460&r1=127459&r2=127460&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Thu Mar 10 22:56:58 2011
> @@ -1757,6 +1757,7 @@
>       // 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);
>
> Modified: cfe/trunk/test/SemaCXX/return.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/return.cpp?rev=127460&r1=127459&r2=127460&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/return.cpp (original)
> +++ cfe/trunk/test/SemaCXX/return.cpp Thu Mar 10 22:56:58 2011
> @@ -49,3 +49,7 @@
>     const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
>   };
>  }
> +
> +class foo  {
> +  operator int * const ();
> +};

Is there some reason we don't want to warn here?  Or is this just a
quick hack for 2.9?

-Eli




More information about the cfe-commits mailing list