From: Saleem Abdulrasool Date: Wed, 21 Jan 2015 19:39:10 +0000 (+0000) Subject: Fix isTriviallyCopyableType for arrays X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa1a735bd76597b743d710b63e5fc6de63bf939f;p=clang Fix isTriviallyCopyableType for arrays Fix isTriviallyCopyableType for arrays. An array of type T is trivially copyable if T is trivially copyable. Patch by Agustín Bergé! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226696 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 5a39ca0c6b..cfa7389db6 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -1089,7 +1089,7 @@ bool QualType::isTrivialType(ASTContext &Context) const { 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()) { diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp index 4833c14b30..2265c28476 100644 --- a/test/SemaCXX/type-traits.cpp +++ b/test/SemaCXX/type-traits.cpp @@ -1857,6 +1857,9 @@ void trivial_checks() { 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))]; }