masaori335 commented on a change in pull request #6241:
URL: https://github.com/apache/trafficserver/pull/6241#discussion_r537243211



##########
File path: include/tscore/Allocator.h
##########
@@ -152,7 +153,7 @@ template <class C> class ClassAllocator : public Allocator
     @param tail pointer to be freed.
     @param num_item of blocks to be freed.
    */
-  void
+  std::enable_if_t<!Destruct_on_free, void>

Review comment:
       I'm not a bit familiar with SFINAE. Let me clarify, which is your 
intention here when `Destruct_on_free == true` ?
   a). do not define this function 
   or 
   b). make a compile error
   
   Background: I got a `'enable_if' cannot be used to disabl
   e this declaration` error when I tried setting the flag `true` like 
`ClassAllocator<UnixNetVConnection, true>`. If your intention is to do not 
declare/define this function, this error seems not expected.
   ```
   /usr/local/opt/llvm/include/c++/v1/type_traits:542:78: error: no type named 
'type' in 'std::__1::enable_if<false, void>'; 'enable_if' cannot be used to 
disabl
   e this declaration
   template <bool _Bp, class _Tp = void> using enable_if_t = typename 
enable_if<_Bp, _Tp>::type;
                                                                                
^~~
   ../../include/tscore/Allocator.h:156:8: note: in instantiation of template 
type alias 'enable_if_t' requested here
     std::enable_if_t<!Destruct_on_free, void>
          ^                                                                     
                                                                                
 UnixNetProcessor.cc:334:10: note: in instantiation of template class 
'ClassAllocator<UnixNetVConnection, true>' requested here
       vc = THREAD_ALLOC_INIT(netVCAllocator, t);
            ^
   
/Users/masaori/src/github.com/apache/trafficserver-review/iocore/eventsystem/I_ProxyAllocator.h:114:35:
 note: expanded from macro 'THREAD_ALLOC_INIT'
   #define THREAD_ALLOC_INIT(_a, _t) thread_alloc_init(::_a, _t->_a)
   ```
   ( clang version 11.0.0 )
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to