Search

[C++] Failure to compile functions taking template template arguments of dependent types by CodingCat

Closed
as Fixed Help for as Fixed

6
0
Sign in
to vote
Type: Bug
ID: 682688
Opened: 8/2/2011 10:37:07 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
The VC++ 2010 compiler refuses to compile any calls of functions taking template template arguments of dependent types, see code in 'Steps to reproduce'.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010 SP1

Steps to reproduce

template <int I>
struct my_int
{
    static const int value = I;
};

// Compiles just fine
template <template <int> class IntTemplate>
int five()
{
    return IntTemplate<5>::value;
}

// Fails to compile
template <class T, template <T> class TTemplate>
T five()
{
    return TTemplate<5>::value;
}

template <class T>
struct five_wrapper
{
    // Even this one fails to compile
    template <template <T> class TTemplate>
    static T five()
    {
        return TTemplate<5>::value;
    }
};

int main()
{
    five<my_int>();

    // error C3208: template parameter list for class template 'my_int' does not
    // match template parameter list for template template parameter 'TTemplate'
    five<int, my_int>();

    // error C3208: template parameter list for class template 'my_int' does not
    // match template parameter list for template template parameter 'TTemplate'
    five_wrapper<int>::five<my_int>();

    return 0;
}

Product Language

English

Operating System

Windows Vista

Operating System Language

German

Actual results

The compiler rejects the last two calls, see comments in 'Steps to reproduce'.

Expected results

The compiler should accept all three calls (gcc does).
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 9/22/2011 at 10:41 PM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by MS-Moderator08 [Feedback Moderator] on 8/2/2011 at 7:49 PM
Thank you for submitting feedback on Visual Studio 2010 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 MS-Moderator01 on 8/2/2011 at 10:50 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)
Sign in to post a workaround.