Separated declaration and definition of a template function using template-of-template does not compile - by halfdan

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 738324 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 4/23/2012 11:19:40 AM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration


I'm porting a large library to Windows and ran into the code below, which does not compile in either MSVC 2008 or 2010 (my compiler targets on Windows):

class A
    template<typename C, template<typename> class B >
    typename B<C>::type func() const;

template< class C, template<typename> class B>
typename B<C>::type A::func() const
    return 1;

If I modify it to the form below, it compiles quite happily:

class A
    template<typename C, template<typename> class B >
    typename B<C>::type func() const
          return 1;

This works fine in gcc 4.4, 4.5 and clang (any version).

Sign in to post a comment.
Posted by Ulzii [MSFT] on 4/27/2012 at 3:52 PM

Thanks for this bug report. This indeed was a bug in compiler. We have fixed the bug now in the next major release of Visual Studio.

Ulzii Luvsanbat
Visual C++ Team
Posted by MS-Moderator08 [Feedback Moderator] on 4/23/2012 at 10:58 PM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.

Posted by MS-Moderator01 on 4/23/2012 at 11:48 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(