]> granicus.if.org Git - clang/commitdiff
Test POD and trivial type traits given a class derived from a generic
authorChandler Carruth <chandlerc@gmail.com>
Sat, 23 Apr 2011 20:51:42 +0000 (20:51 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 23 Apr 2011 20:51:42 +0000 (20:51 +0000)
non-POD type.

It might be nicer to have a Derives* variant for each of HasCons,
HasCopy, etc. Then we could test each of those and also test the __has_*
traits. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130074 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/type-traits.cpp

index a4b59fb39e229b15753b59b5a9f211512df6a7ae..9255cdd13fde1bc4e53c8b91189bfa8e295e4699 100644 (file)
@@ -33,6 +33,7 @@ struct Derives : POD {};
 typedef Derives DerivesAr[10];
 typedef Derives DerivesArNB[];
 struct DerivesEmpty : Empty {};
+struct DerivesNonPOD : NonPOD {};
 struct HasCons { HasCons(int); };
 struct HasCopyAssign { HasCopyAssign operator =(const HasCopyAssign&); };
 struct HasDest { ~HasDest(); };
@@ -99,6 +100,7 @@ void is_pod()
   { int arr[F(__is_pod(DerivesAr))]; }
   { int arr[F(__is_pod(DerivesArNB))]; }
   { int arr[F(__is_pod(DerivesEmpty))]; }
+  { int arr[F(__is_pod(DerivesNonPOD))]; }
   { int arr[F(__is_pod(HasCons))]; }
   { int arr[F(__is_pod(HasCopyAssign))]; }
   { int arr[F(__is_pod(HasDest))]; }
@@ -589,6 +591,7 @@ void is_trivial()
   { int arr[F(__is_trivial(HasVirt))]; }
   { int arr[F(__is_trivial(IntArNB))]; }
   { int arr[F(__is_trivial(DerivesArNB))]; }
+  { int arr[F(__is_trivial(DerivesNonPOD))]; }
   { int arr[F(__is_trivial(void))]; }
   { int arr[F(__is_trivial(cvoid))]; }
 }