Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bug in variadic function template specialization with MSVC?

Using the Visual Studio Nov 2012 CTP, which supports variadic templates (among other things). The following code:

template<int, typename... Args>
void myfunc(Args... args)
{
}

template<>
void myfunc<1, float>(float)
{
}

produces the following errors:

error C2785: 'void myfunc(Args...)' and 'void myfunc(float)' have different return types
error C2912: explicit specialization 'void myfunc(float)' is not a specialization of a function template

(yeah, the first one is pretty funny)

So my questions are:

1) Am I writing legal C++11 here?

2) If yes, is there a way to find out if this is a known bug in MSVC before submitting it?

like image 342
Andrei Tita Avatar asked Nov 19 '25 22:11

Andrei Tita


1 Answers

  1. This is perfectly legitimate code; both gcc-4.7.2 and clang 3.0 accept it.

  2. Try searching Microsoft Connect.

like image 137
ecatmur Avatar answered Nov 22 '25 12:11

ecatmur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!