[cfe-dev] clang-cl, _HAS_EXCEPTIONS, and Microsoft

Edward Diener eldlistmailingz at tropicsoft.com
Wed Jan 8 08:56:57 PST 2014

On 1/8/2014 11:04 AM, Reid Kleckner wrote:
> I agree, _HAS_EXCEPTIONS=0 is undocumented and unsupported, but it's
> useful to us for the moment.  Things are probably going to progress in
> the following way:
> 1. Finish getting clang to self-host with clang-cl with and without
> optimizations with _HAS_EXCEPTIONS=0.  This is blocked by pass-by-value
> of non-trivial types.
> 2. Parse exceptions, but drop them on the floor with a warning like you
> get from cl /EHs-c-.  This should make that confusing error about RTTI
> mangling go away and have the effect of turning off exceptions.
> 3. Make RTTI work, because we need it for exceptions, and it's fairly
> simple.
> 4 .Make exceptions work.
> Programs that rely on exceptions (any user of concrt.h) won't work until
> we get to 4, obviously, but I expect there's a large amount of code that
> only uses exceptions in STL headers that would work with 2.

My point is that concrt.h is being included by standard Microsoft header 
files irregardless of whether _HAS_EXCEPTIONS is 0 or not. As soon as 
concrt.h is included when _HAS_EXCEPTIONS is 0 there will be a compiler 
error, both in VC++ and clang-cl. So some innocent #include of a 
standard C++ header file will bring in concrt.h and the error will occur 
when _HAS_EXCEPTIONS is 0.

If 2) fixes that problem that is fine, but having to set _HAS_EXCEPTIONS 
to 0 is the cause of the problem and it will not go away until the 
setting of _HAS_EXCEPTIONS to 0 for clang-cl goes away.

More information about the cfe-dev mailing list