[Codename Milan] Using a name with a variadic template inside template<> brackets doesn't work - by Malte Skarupke

Status : 

 


1
0
Sign in
to vote
ID 775492 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/31/2012 5:12:08 AM
Access Restriction Public

Description

It seems like you can't use types that have been expanded using variadic templates inside template<> brackets.

Here is some code that works fine in GCC (4.7.2) and Clang (3.2) but doesn't work in Visual Studio November CTP:

#include <iostream>

template<typename>
struct complicated_call;

template<typename Result, typename... Args>
struct complicated_call<Result (*)(Args...)>
{
	template<Result (*func)(Args...)>
	static Result call(Args... args)
	{
		return (*func)(std::forward<Args>(args)...);
	}
};


int foo(int a)
{
   return a + 1;
}


int main()
{
   std::cout << complicated_call<int (*)(int)>::call<&foo>(5) << std::endl;
}


I tried to work around the issue by using
typedef Result (*FuncType)(Args...);
but that also does not work.
Sign in to post a comment.
Posted by Microsoft on 11/14/2013 at 2:09 PM
Hi: a fix for this issue has been applied to the compiler. The fix should show up in the next release of Visual C++.

Thanks
Jonathan Caves
Visual C++ Compiler Team
Posted by Microsoft on 12/31/2012 at 9:16 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 12/31/2012 at 5:55 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)