VS2010 and /clr: fatal error C1001: An internal error has occurred in the compiler

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
I recently switched our product over to VS2010 from VS2008. Our solution consists of several native C++ projects and some managed C++ projects that link to those native projects.
<br/>
<br/>
The managed C++ projects are compiled with the /clr flag, of course. However, when compiling for x64, one of the files that includes one of the boost mutex headers causes the compiler to spit out the following error:<br/>
<br/>
boost_1_43_0_sdkincludeboostthreadwin32basic_timed_mutex.hpp(158): fatal error C1001: An internal error has occurred in the compiler<br/>
<br/>
Ive traced down the problem to the following piece of code in basic_timed_mutex.hpp:<br/>
<div style="color:Black; background-color:White
<pre><span style="color:Blue void
unlock()
{
<span style="color:Blue long
<span style="color:Blue const
offset=lock_flag_value;

<span style="color:Green // If I comment out this line, compilation works

<span style="color:Blue long
<span style="color:Blue const
old_count=BOOST_INTERLOCKED_EXCHANGE_ADD(&active_count,lock_flag_value);

<span style="color:Blue if
(!(old_count&event_set_flag_value) && (old_count>offset))
{
<span style="color:Blue if
(!win32::interlocked_bit_test_and_set(&active_count,event_set_flag_bit))
{
win32::SetEvent(get_event());
}
}
}
[/code]

When compiling for x86, I see the following warning but everything still compiles:
4>boost_1_43_0_sdkincludeboostthreadwin32basic_timed_mutex.hpp(160): warning C4793: boost::detail::basic_timed_mutex::unlock : function compiled as native :<br/>
4> Found an intrinsic not supported in managed code
It would see the BOOST_INTERLOCKED_EXCHANGE_ADD macro causes the compiler to barf. Does anybody have any ideas on why this is, or how to fix it?<br/>
<br/>
Cheers,<br/>
Soren

View the full article
 
Back
Top