From 78ef0957d4488ac4873afd1460999c7fb239a128 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 23 Apr 2011 21:02:37 +0000 Subject: [PATCH] Flesh out these tests just a tad more. This provides targeted 'DerivesHasFoo' types for various non-POD constructs in the base class. Only __is_pod and __is_trivial are wired up to these, not sure how much more of this type of exhaustive testing is really interesting. llvm-svn: 130075 --- clang/test/SemaCXX/type-traits.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp index 9255cdd13fde..70aec32b088a 100644 --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -33,7 +33,6 @@ 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(); }; @@ -46,6 +45,13 @@ typedef NonPOD NonPODAr[10]; typedef HasVirt VirtAr[10]; typedef NonPOD NonPODArNB[]; union NonPODUnion { int i; Derives n; }; +struct DerivesHasCons : HasCons {}; +struct DerivesHasCopyAssign : HasCopyAssign {}; +struct DerivesHasDest : HasDest {}; +struct DerivesHasPriv : HasPriv {}; +struct DerivesHasProt : HasProt {}; +struct DerivesHasRef : HasRef {}; +struct DerivesHasVirt : HasVirt {}; struct HasNoThrowCopyAssign { void operator =(const HasNoThrowCopyAssign&) throw(); @@ -100,7 +106,6 @@ 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))]; } @@ -108,6 +113,13 @@ void is_pod() { int arr[F(__is_pod(HasProt))]; } { int arr[F(__is_pod(HasRef))]; } { int arr[F(__is_pod(HasVirt))]; } + { int arr[F(__is_pod(DerivesHasCons))]; } + { int arr[F(__is_pod(DerivesHasCopyAssign))]; } + { int arr[F(__is_pod(DerivesHasDest))]; } + { int arr[F(__is_pod(DerivesHasPriv))]; } + { int arr[F(__is_pod(DerivesHasProt))]; } + { int arr[F(__is_pod(DerivesHasRef))]; } + { int arr[F(__is_pod(DerivesHasVirt))]; } { int arr[F(__is_pod(NonPOD))]; } { int arr[F(__is_pod(HasNonPOD))]; } { int arr[F(__is_pod(NonPODAr))]; } @@ -582,6 +594,8 @@ void is_trivial() { int arr[T(__is_trivial(HasAnonymousUnion))]; } { int arr[T(__is_trivial(HasPriv))]; } { int arr[T(__is_trivial(HasProt))]; } + { int arr[T(__is_trivial(DerivesHasPriv))]; } + { int arr[T(__is_trivial(DerivesHasProt))]; } { int arr[F(__is_trivial(HasCons))]; } { int arr[F(__is_trivial(HasCopyAssign))]; } @@ -589,9 +603,13 @@ void is_trivial() { int arr[F(__is_trivial(HasRef))]; } { int arr[F(__is_trivial(HasNonPOD))]; } { int arr[F(__is_trivial(HasVirt))]; } + { int arr[F(__is_trivial(DerivesHasCons))]; } + { int arr[F(__is_trivial(DerivesHasCopyAssign))]; } + { int arr[F(__is_trivial(DerivesHasDest))]; } + { int arr[F(__is_trivial(DerivesHasRef))]; } + { int arr[F(__is_trivial(DerivesHasVirt))]; } { 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))]; } }