C2143 error when compiling C++ code with variadic templates - by Michał Wawrzyniec Urbańczyk

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 801828 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/21/2013 4:20:11 PM
Access Restriction Public


I found another bug affecting Qt framework. 
When I compile with Visual Studio 2013 RC the following C++ code:

#include <iostream>

template <typename...>
struct List {};

template<typename ...Args>
struct FivesGenerator {
	static inline int generateFive() {
		return 5;

template <typename ArgList>
struct Bar {
	static const int *types() { return 0; }

template <typename... Args>
struct Bar<List<Args...> > {
	static const int *types() {
		static const int t[sizeof...(Args)+1] = { (FivesGenerator<Args>::generateFive())..., 1 };
		return t;

int main() {
	std::cout << *Bar<List<int> >::types() << " " << *Bar<List<> >::types() << std::endl;

I get the compilation error C2143: syntax error : missing '}' before '<fake-type>'

The code should compile fine and print "5 1". It works both with GCC and Clang.
Sign in to post a comment.
Posted by Jonathan [MSFT] on 1/6/2014 at 7:07 AM
Hi: a fix for this issue has been checked into the compiler sources. The fix should show up in a future release of Visual C++.

Jonathan Caves
Visual C++ Compiler Team
Posted by Macy [MSFT] on 9/21/2013 at 4:51 PM
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)