Search

Compiler bug - cannot access private member declared in class by JamesWebb

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 682454
Opened: 7/31/2011 5:02:20 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
This code works in gcc v4.5.2 but not in vs2010 sp1

Code From: http://pizer.wordpress.com/2008/11/22/scope-guards-revisited-c0x-style/

error C2248: 'scope_guard_with_functor<F>::scope_guard_with_functor' : cannot access private member declared in class 'scope_guard_with_functor<F>'
with
[
    F=void (__cdecl *)(void)
]
c:\src\scoped\scoped_test_4\scoped_test_4.cpp(29) : see declaration of 'scope_guard_with_functor<F>::scope_guard_with_functor'
with
[
    F=void (__cdecl *)(void)
]
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

Just try to compile the code the from http://pizer.wordpress.com/2008/11/22/scope-guards-revisited-c0x-style/

In a console win32 debug mode

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

error C2248: 'scope_guard_with_functor<F>::scope_guard_with_functor' : cannot access private member declared in class 'scope_guard_with_functor<F>'    c:\src\scoped\scoped_test_4\scoped_test_4.cpp    57    1    Scoped_Test_4

Output:
1>------ Rebuild All started: Project: Scoped_Test_4, Configuration: Debug Win32 ------
1> Scoped_Test_4.cpp
1>c:\src\scoped\scoped_test_4\scoped_test_4.cpp(57): error C2248: 'scope_guard_with_functor<F>::scope_guard_with_functor' : cannot access private member declared in class 'scope_guard_with_functor<F>'
1>         with
1>         [
1>             F=void (__cdecl *)(void)
1>         ]
1>         c:\src\scoped\scoped_test_4\scoped_test_4.cpp(29) : see declaration of 'scope_guard_with_functor<F>::scope_guard_with_functor'
1>         with
1>         [
1>             F=void (__cdecl *)(void)
1>         ]
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Expected results

It should compile just fine
File Attachments
File Name Submitted By Submitted On File Size  
Scoped_Test_4.cpp 7/31/2011 1 KB
Sign in to post a comment.
Posted by Microsoft on 8/13/2011 at 6:31 PM
Hi: this bug has been fixed and the fix will show up in a future release of Visual C++

Thanks
Jonathan Caves
Visual C++ Compiler Team
Posted by MS-Moderator09 [Feedback Moderator] on 7/31/2011 at 9:29 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 review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 7/31/2011 at 5:48 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)
Sign in to post a workaround.