Fix isTriviallyCopyableType for arrays
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 21 Jan 2015 19:39:10 +0000 (19:39 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 21 Jan 2015 19:39:10 +0000 (19:39 +0000)
Fix isTriviallyCopyableType for arrays. An array of type T is trivially copyable
if T is trivially copyable.

Patch by Agustín Bergé!

llvm-svn: 226696

clang/lib/AST/Type.cpp
clang/test/SemaCXX/type-traits.cpp

index 5a39ca0..cfa7389 100644 (file)
@@ -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()) {
index 4833c14..2265c28 100644 (file)
@@ -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))]; }