I have the following minified code.
The line with // Only VS
compiles on VS but not on clang,
And the line with // Only clang
compiles on clang but not on VS.
Who is correct? More importantly, how to make an equivalent line compile on both?
The versions tested are clang 3.7.0, and VS 2015.
#include <functional>
#include <tuple>
template<typename... Args>
class C
{
struct B
{
std::function<void(Args...)> func;
B(std::function<void(Args...)> func) : func(func) { }
};
template<typename T>
struct D : B
{
using B::B;
template<size_t... I>
void Call(T &t, std::index_sequence<I...>)
{
func(std::get<I>(t)...); // Only VS
B::template func(std::get<I>(t)...); // Only clang
}
};
D<std::tuple<Args...>> d;
public:
C(std::function<void(Args...)> func) : d(func) { }
void Call()
{
std::tuple<Args...> t;
d.Call(t, std::make_index_sequence<sizeof...(Args)>());
}
};
void f(int)
{
}
int main()
{
C<int> c(f);
c.Call();
}