[cfe-dev] SFINAE in variadic templates?

Jim Porter via cfe-dev cfe-dev at lists.llvm.org
Sat Jan 23 13:32:33 PST 2016


Is <https://llvm.org/bugs/show_bug.cgi?id=23840> a valid issue? 
[temp.deduct] p7 seems to say so, but I'd be happy to have a 
more-experienced language lawyer confirm this. Here's the relevant text: 
"The substitution [from template argument deduction] occurs in *all* 
types and expressions that are used in the function type and in template 
parameter declarations." (Emphasis mine.) That would imply that the 
following would trigger SFINAE, right?

   template<typename T> struct always_false : std::false_type {};
   template<typename T, std::enable_if_t<always_false<T>::value, int>...>
   void func(T &) {}

As the bug notes, this issue makes it impossible to use libstdc++'s 
implementation of <experimental/optional>. If the issue is indeed in 
clang, I could take a look at fixing this.

Thanks,
Jim




More information about the cfe-dev mailing list