Home Dashboard Directory Help
Search

Failed to compile program using boost::program_options and lambda expression by jensa79


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 720670
Opened: 1/25/2012 12:53:57 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Hi,

compiling the following program fails with the error message:
Error 1 error C2871: 'validators' : a namespace with this name does not exist
Error 2 error C2871: 'program_options' : a namespace with this name does not exist

#include <boost/program_options.hpp>


template<typename T> void f(T t) {}


void g()
{
using namespace boost::program_options;


// each of the following lines produces the error:
// Error 1 error C2871: 'validators' : a namespace with this name does not exist
// Error 2 error C2871: 'program_options' : a namespace with this name does not exist


f([]() {} );
auto x = []() {};
}

The same source code compiles fine with gcc and I don't see any reason for the error, so I suspect a compiler problem.
Details
Sign in to post a comment.
Posted by Microsoft on 2/1/2012 at 3:55 PM
Hello,

Thank you for reporting this bug. We've made sure that this bug is fixed in the current in-progress release of Visual Studio. Next major release of VS will have the fix.

In the meantime, you workaround the bug by moving up the using namespace statement into global scope:
using namespace boost::program_options;
template<typename T> void f(T t) {}

void g()
{
// using namespace boost::program_options;

f([]() {} );
auto x = []() {};
}

Thanks,
Ulzii Luvsanbat
Windows C++ Team
Posted by MS-Moderator07 [Feedback Moderator] on 1/25/2012 at 7:39 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 1/25/2012 at 1:43 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.
File Name Submitted By Submitted On File Size  
program_options_and_lambda.zip 1/25/2012 244 KB