Re: [boost] [Boost-users] [ScopeExit/Typeof] Can't build simple test in debugmode (MSVC 7.1 and 8.0)

Hi, I've moved this to the dev list, because it should probably be mentioned in the documentation somewhere. I'm not sure whether it belongs in Typeof or ScopeExit. I've tried building the hello.cpp example that comes with ScopeExit with the same results (as in my original message). I think I have narrowed down the cause. Building fails whenever "Program Database for Edit & Continue (/ZI)" is set in the project properties. Changing this to "Program Database (/Zi)" or any other fixes the problem. Is this a compiler bug? I never use Edit & Continue anyway, but I thought it might be helpful to others to mention this problem somewhere. Best regards, Christian Larsen Christian Larsen wrote:
I'm trying build a very simple test program using ScopeExit (just downloaded from the link in the review notice: http://boost- consulting.com/vault/index.php?action=downloadfile&filename=sco pe_exit-0.04.tar.gz&directory=& ). I'm using a brand new download of Boost 1.34.1 with it. The following code builds and runs fine in release mode in both VC7.1 and 8.0, but fails to build in debug mode in both versions. I also tried specifying the BOOST_TYPEOF_COMPLIANT in MSVC7.1 debug but to no avail - I just get some other errors. I couldn't find any indication of what would cause this difference between debug/release builds. I tried disabling optimizations in release mode to check whether this would cause release mode to fail, too, but it didn't. Any help would be appreciated.
Code:
#include <iostream> #include <boost/scope_exit.hpp>
int main(int argc, char* argv[]) { bool commit = false;
BOOST_SCOPE_EXIT( (commit) ) { if( !commit ) std::cerr << "Not committed!\n"; } BOOST_SCOPE_EXIT_END
//commit = true; return 0; }
[SNIP]
Building debug mode MSVC 7.1 (with BOOST_TYPEOF_COMPLIANT):
Compiling... ScopeExitTest.cpp using typeof emulation d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2440: 'type cast' : cannot convert from 'long' to 'main::commit_boost_scope_exit_nested_typeof' Source or target has incomplete type d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2143: syntax error : missing ';' before ':' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2143: syntax error : missing ';' before ':' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2143: syntax error : missing ';' before '{' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2039: 'type' : is not a member of 'operator``global namespace''' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2513: 'int' : no variable declared before '=' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2146: syntax error : missing ';' before identifier 'type' d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2065: 'type' : undeclared identifier d:\Development\Misc\ScopeExitTest\ScopeExitTest.cpp(8) : error C2146: syntax error : missing ';' before identifier 'commit_boost_scope_exit_typeof'
[SNIP]
participants (1)
-
Christian Larsen