@@ -863,8 +863,9 @@ class KernelObjVisitor {
863
863
864
864
// Base case, only calls these when filtered.
865
865
template <typename ... FilteredHandlers, typename ParentTy>
866
- void VisitUnion (FilteredHandlers &... handlers, const CXXRecordDecl *Owner,
867
- ParentTy &Parent, const CXXRecordDecl *Wrapper) {
866
+ std::enable_if_t <(sizeof ...(FilteredHandlers) > 0 )>
867
+ VisitUnion (FilteredHandlers &... handlers, const CXXRecordDecl *Owner,
868
+ ParentTy &Parent, const CXXRecordDecl *Wrapper) {
868
869
(void )std::initializer_list<int >{
869
870
(handlers.enterUnion (Owner, Parent), 0 )...};
870
871
VisitRecordHelper (Wrapper, Wrapper->fields (), handlers...);
@@ -877,11 +878,10 @@ class KernelObjVisitor {
877
878
void VisitUnion (const CXXRecordDecl *Owner, ParentTy &Parent,
878
879
const CXXRecordDecl *Wrapper) {}
879
880
880
- // Add overloads including the base case when
881
- // sizeof...(FilteredHandlers) > 0.
882
881
template <typename ... FilteredHandlers, typename ParentTy,
883
882
typename CurHandler, typename ... Handlers>
884
- std::enable_if_t <!CurHandler::VisitUnionBody>
883
+ std::enable_if_t <!CurHandler::VisitUnionBody &&
884
+ (sizeof ...(FilteredHandlers) > 0 )>
885
885
VisitUnion (FilteredHandlers &... filtered_handlers,
886
886
const CXXRecordDecl *Owner, ParentTy &Parent,
887
887
const CXXRecordDecl *Wrapper, CurHandler &cur_handler,
@@ -892,7 +892,8 @@ class KernelObjVisitor {
892
892
893
893
template <typename ... FilteredHandlers, typename ParentTy,
894
894
typename CurHandler, typename ... Handlers>
895
- std::enable_if_t <CurHandler::VisitUnionBody>
895
+ std::enable_if_t <CurHandler::VisitUnionBody &&
896
+ (sizeof ...(FilteredHandlers) > 0 )>
896
897
VisitUnion (FilteredHandlers &... filtered_handlers,
897
898
const CXXRecordDecl *Owner, ParentTy &Parent,
898
899
const CXXRecordDecl *Wrapper, CurHandler &cur_handler,
0 commit comments