Variadic Template expansion Crashes when expanding complex template - by jdberger

Status : 


Sign in
to vote
ID 813426 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 1/9/2014 3:42:41 PM
Access Restriction Public


Compiler dies with "An internal error has occurred in the compiler." when trying to compile a traits expansion in a variadic expansion. See code below. 

Run snippet at:

#include <iostream>
#include <type_traits>
#include <string>

template <typename T, bool Enable = std::is_compound<T>::value >
struct sane_ref_type{
  typedef T type;

template <typename T>
struct sane_ref_type<T, true>{
  typedef const T& type;

template <typename T, typename... Z> struct head { typedef T type; };

template <typename... T> struct test { typedef typename head< typename sane_ref_type<T>::type...>::type type; };

int main()
  test<int,std::string>::type a = 10;
	std::cout << "Hello, World!" << std::endl;
Sign in to post a comment.
Posted by Microsoft on 6/6/2014 at 9:53 AM
Thank you for using Visual Studio and for reporting this bug. We are happy to let you know that this issue has been fixed in Visual Studio 2013 Update 2. If you already have Visual Studio 2013, you can upgrade to Update 2 for free or you can install a trial version from:
Posted by Microsoft on 2/7/2014 at 7:35 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 Microsoft on 1/9/2014 at 8:32 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/9/2014 at 3:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(