Search

Impossibility of using typename with storage class specifier static in lambda expressions by Сыроежка

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 744323
Opened: 5/27/2012 10:17:30 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
The compiler does not allow to use typename with storage class specifier static in lambda expressions in declaring variables.
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

#include "stdafx.h"
#include    <iterator>

template <typename Iterator>
void f( Iterator )
{
    // The statement below is compiled without errors
    static typename std::iterator_traits<Iterator>::difference_type n;
}

template <typename Iterator>
void f1( Iterator )
{
    auto lm = []()
             {
        // The statement below generates a compilation error
        static typename std::iterator_traits<Iterator>::difference_type n;
             };
}

int _tmain(int argc, _TCHAR* argv[])
{
    int *p = 0;
    f( p );
    f1( p );

    return 0;
}

Product Language

Russian

Operating System

Windows 7

Operating System Language

Russian

Actual results

Compilation error

error C2899: использование typename вне объявления шаблона не допускается

Expected results

The presented example shall be compiled without errors.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 5/28/2012 at 2:15 PM
Hello,

Thank you for reporting this bug. We have fixed this in the VS11 RC release, next major release will have the fix.

Thanks,
Ulzii Luvsanbat
Visual C++ Team
Posted by MS-Moderator08 [Feedback Moderator] on 5/28/2012 at 12:53 AM
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 5/27/2012 at 10:42 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.