[PATCH] Fix isTriviallyCopyableType for arrays

Richard Smith richard at metafoo.co.uk
Wed Jan 21 09:12:42 PST 2015


LGTM
On 21 Jan 2015 08:25, "Agustín Bergé" <kaballo86 at hotmail.com> wrote:

> Hi rsmith,
>
> Fix `isTriviallyCopyableType` for arrays. An array of type `T` is
> trivially copyable if `T` is trivially copyable.
>
> http://reviews.llvm.org/D7096
>
> Files:
>   lib/AST/Type.cpp
>   test/SemaCXX/type-traits.cpp
>
> Index: lib/AST/Type.cpp
> ===================================================================
> --- lib/AST/Type.cpp
> +++ lib/AST/Type.cpp
> @@ -1089,7 +1089,7 @@
>
>  bool QualType::isTriviallyCopyableType(ASTContext &Context) const {
>    if ((*this)->isArrayType())
> -    return Context.getBaseElementType(*this).isTrivialType(Context);
> +    return
> Context.getBaseElementType(*this).isTriviallyCopyableType(Context);
>
>    if (Context.getLangOpts().ObjCAutoRefCount) {
>      switch (getObjCLifetime()) {
> Index: test/SemaCXX/type-traits.cpp
> ===================================================================
> --- test/SemaCXX/type-traits.cpp
> +++ test/SemaCXX/type-traits.cpp
> @@ -1857,6 +1857,9 @@
>    { int arr[T(__is_trivially_copyable(HasNonPOD))]; }
>    { int arr[T(__is_trivially_copyable(DerivesHasCons))]; }
>    { int arr[T(__is_trivially_copyable(DerivesHasRef))]; }
> +  { int arr[T(__is_trivially_copyable(NonTrivialDefault))]; }
> +  { int arr[T(__is_trivially_copyable(NonTrivialDefault[]))]; }
> +  { int arr[T(__is_trivially_copyable(NonTrivialDefault[3]))]; }
>
>    { int arr[F(__is_trivially_copyable(HasCopyAssign))]; }
>    { int arr[F(__is_trivially_copyable(HasMoveAssign))]; }
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150121/634ce904/attachment.html>


More information about the cfe-commits mailing list