[PATCH] Fix isTriviallyCopyableType for arrays
Agustín Bergé
kaballo86 at hotmail.com
Wed Jan 21 08:25:23 PST 2015
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 --------------
A non-text attachment was scrubbed...
Name: D7096.18520.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150121/13aefcf1/attachment.bin>
More information about the cfe-commits
mailing list