Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22002

SFINAE with incomplete type template overload doesn't work with Clang while it works with GCC

$
0
0

I cannot compile the following snippet with Clang, while GCC has no problem:

template <typename T, int variant=0>struct FooCallerWrapper;template <typename T>struct FooCallerWrapper<T, 0>{    typedef int FooCallerType;};template<class SERVICE_T, int variant = 0>class FooCaller{    template<typename Dummy>    struct Void { typedef void type; };    template<typename R = void, typename Enabled = void>    struct EnableIfHasNextVariant { };    template<typename R>    struct EnableIfHasNextVariant<        R,        typename Void<typename FooCallerWrapper<SERVICE_T, variant+1>::FooCallerType>::type>    {        typedef R type;    };};FooCaller<int> foo;

I have read this question, but I cannot understand how to fix it in my case.

I tested with Clang 3.1, 8.0 and 10.0, and with GCC 5.1 and 9.3.


Viewing all articles
Browse latest Browse all 22002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>