# Clang-cl disable exceptions/rtti and macro issue

**URL:** <https://discourse.llvm.org/t/clang-cl-disable-exceptions-rtti-and-macro-issue/31994>\
**Category:** Clang Frontend\
**Created:** [May 4, 2014, 1:26pm UTC](https://discourse.llvm.org/t/clang-cl-disable-exceptions-rtti-and-macro-issue/31994 "2014-05-04T13:26:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kim](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@Kim](https://discourse.llvm.org/u/Kim)\
**Post date:** [May 4, 2014, 1:26pm UTC](https://discourse.llvm.org/t/clang-cl-disable-exceptions-rtti-and-macro-issue/31994/1 "2014-05-04T13:26:04Z")

</div>

Hi guys,

I have a couple of problems while trying to compile my program using Clang-cl. First issue, even passing /GR- and Xclang -fno-rtti I get:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
error: cannot mangle RTTI descriptors for type 'bad\_cast' yet  
error: cannot mangle the name of type 'bad\_cast' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'exception' yet  
error: cannot mangle the name of type 'exception' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'bad\_cast' yet  
error: cannot mangle the name of type 'bad\_cast' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'exception' yet  
error: cannot mangle the name of type 'exception' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'bad\_cast' yet  
error: cannot mangle the name of type 'bad\_cast' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'exception' yet  
error: cannot mangle the name of type 'exception' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'bad\_cast' yet  
error: cannot mangle the name of type 'bad\_cast' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'exception' yet  
error: cannot mangle the name of type 'exception' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'bad\_cast' yet  
error: cannot mangle the name of type 'bad\_cast' into RTTI descriptors yet  
error: cannot mangle RTTI descriptors for type 'exception' yet  
fatal error: too many errors emitted, stopping now [-ferror-limit=]  
2 warnings and 20 errors generated.

And I can't find a switch for disabling exceptions.

Second problem (I think I've encountered this before and fixed it with -fno-delayed-template-parsing, however it doesn't seem to work on clang-cl or the argument has since been removed from clang)

In file included from I:\boost\_1\_55\_0\boost/filesystem.hpp:16:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path.hpp:25:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path\_traits.hpp:22:  
In file included from I:\boost\_1\_55\_0\boost/type\_traits/decay.hpp:18:  
In file included from I:\boost\_1\_55\_0\boost/mpl/eval\_if.hpp:17:  
I:\boost\_1\_55\_0\boost/mpl/if.hpp(131,1) : error: pasting formed 'BOOST\_PP\_TUPLE\_ELEM\_E\_2(', an invalid preprocessing token [-Winvalid-token-paste]  
BOOST\_MPL\_AUX\_NA\_SPEC(3, if\_)  
^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(161,40) : note: expanded from macro 'BOOST\_MPL\_AUX\_NA\_SPEC'  
#define BOOST\_MPL\_AUX\_NA\_SPEC(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(154,47) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI'  
#define BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(65,9) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_MAIN'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BOOST\_MPL\_PP\_NESTED\_DEF\_PARAMS\_TAIL(i, typename T, na) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)  
I:\boost\_1\_55\_0\boost/preprocessor/tuple/elem.hpp(36,114) : note: expanded from macro 'BOOST\_PP\_TUPLE\_ELEM'  
# define BOOST\_PP\_TUPLE\_ELEM(size, n, tuple) BOOST\_PP\_TUPLE\_ELEM\_I(BOOST\_PP\_CAT(BOOST\_PP\_TUPLE\_ELEM\_, n), BOOST\_PP\_CAT(BOOST\_PP\_CAT(BOOST\_PP\_TUPLE\_ELEM\_E\_, size), tuple))  
^  
I:\boost\_1\_55\_0\boost/preprocessor/cat.hpp(22,32) : note: expanded from macro 'BOOST\_PP\_CAT'  
# define BOOST\_PP\_CAT(a, b) BOOST\_PP\_CAT\_I(a, b)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/preprocessor/cat.hpp(31,55) : note: expanded from macro 'BOOST\_PP\_CAT\_I'  
# define BOOST\_PP\_CAT\_I(a, b) BOOST\_PP\_CAT\_II(~, a ## b)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
In file included from C:\Scripta\libs\Root\ScriptaConfig.cpp:1:  
In file included from C:\Scripta\libs\Root/ScriptaConfig.h:2:  
In file included from C:\Scripta\libs\Root/ScriptaLogManager.h:38:  
In file included from C:\Scripta\libs\Root/Utility.h:4:  
In file included from I:\boost\_1\_55\_0\boost/filesystem.hpp:16:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path.hpp:25:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path\_traits.hpp:22:  
In file included from I:\boost\_1\_55\_0\boost/type\_traits/decay.hpp:18:  
In file included from I:\boost\_1\_55\_0\boost/mpl/eval\_if.hpp:17:  
I:\boost\_1\_55\_0\boost/mpl/if.hpp(131,1) : error: pasting formed 'BOOST\_PP\_TUPLE\_ELEM\_1(', an invalid preprocessing token [-Winvalid-token-paste]  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(161,40) : note: expanded from macro 'BOOST\_MPL\_AUX\_NA\_SPEC'  
#define BOOST\_MPL\_AUX\_NA\_SPEC(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(154,47) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI'  
#define BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(65,9) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_MAIN'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BOOST\_MPL\_PP\_NESTED\_DEF\_PARAMS\_TAIL(i, typename T, na) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)  
I:\boost\_1\_55\_0\boost/preprocessor/tuple/elem.hpp(36,53) : note: expanded from macro 'BOOST\_PP\_TUPLE\_ELEM'  
# define BOOST\_PP\_TUPLE\_ELEM(size, n, tuple) BOOST\_PP\_TUPLE\_ELEM\_I(BOOST\_PP\_CAT(BOOST\_PP\_TUPLE\_ELEM\_, n), BOOST\_PP\_CAT(BOOST\_PP\_CAT(BOOST\_PP\_TUPLE\_ELEM\_E\_, size), tuple))  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/preprocessor/tuple/elem.hpp(37,48) : note: expanded from macro 'BOOST\_PP\_TUPLE\_ELEM\_I'  
# define BOOST\_PP\_TUPLE\_ELEM\_I(m, args) BOOST\_PP\_TUPLE\_ELEM\_II(m, args)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/preprocessor/tuple/elem.hpp(38,64) : note: expanded from macro 'BOOST\_PP\_TUPLE\_ELEM\_II'  
# define BOOST\_PP\_TUPLE\_ELEM\_II(m, args) BOOST\_PP\_CAT(m ## args,)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
In file included from C:\Scripta\libs\Root\ScriptaConfig.cpp:1:  
In file included from C:\Scripta\libs\Root/ScriptaConfig.h:2:  
In file included from C:\Scripta\libs\Root/ScriptaLogManager.h:38:  
In file included from C:\Scripta\libs\Root/Utility.h:4:  
In file included from I:\boost\_1\_55\_0\boost/filesystem.hpp:16:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path.hpp:25:  
In file included from I:\boost\_1\_55\_0\boost/filesystem/path\_traits.hpp:22:  
In file included from I:\boost\_1\_55\_0\boost/type\_traits/decay.hpp:18:  
In file included from I:\boost\_1\_55\_0\boost/mpl/eval\_if.hpp:17:  
I:\boost\_1\_55\_0\boost/mpl/if.hpp(131,1) : error: pasting formed 'BOOST\_PP\_TUPLE\_ELEM\_E\_2(', an invalid preprocessing token [-Winvalid-token-paste]  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(161,40) : note: expanded from macro 'BOOST\_MPL\_AUX\_NA\_SPEC'  
#define BOOST\_MPL\_AUX\_NA\_SPEC(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(154,47) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI'  
#define BOOST\_MPL\_AUX\_NA\_SPEC\_NO\_ETI(i, name) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
I:\boost\_1\_55\_0\boost/mpl/aux\_/na\_spec.hpp(65,9) : note: expanded from macro '\  
BOOST\_MPL\_AUX\_NA\_SPEC\_MAIN'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BOOST\_MPL\_PP\_NESTED\_DEF\_PARAMS\_TAIL(i, typename T, na) \  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^

...and so on...

Thanks a lot for your time.

---

<div class="post-metadata">

**Author:** ![rnk](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/rnk/32/1756_2.png) [@rnk](https://discourse.llvm.org/u/rnk)\
**Post date:** [May 5, 2014, 8:20pm UTC](https://discourse.llvm.org/t/clang-cl-disable-exceptions-rtti-and-macro-issue/31994/2 "2014-05-05T20:20:34Z")

</div>

Clang currently doesn’t support exceptions on Windows. What’s happening is that it’s trying to generate code for them, and failing when attempting to build RTTI data for the catch clauses. We need to improve the diagnostic experience here.

As a workaround, if you aren’t using exceptions in your program, you can pass -D\_HAS\_EXCEPTIONS=0 to disable use of exceptions in the Visual C++ STL headers. cl doesn’t have a flag to disable exceptions, and so we never added one to clang-cl.
