#238 typeinfo.h include fails when exceptions are disabled

5.2
open
nobody
5
2010-05-12
2010-05-12
Superlexx
No

Under Win32 (VS2008SP1) with RTTI enabled and exception handling disabled, including <typeinfo.h> gives errors:

STLport\stlport\typeinfo.h(65) : error C2039: 'bad_typeid' : is not a member of '`global namespace''
STLport\stlport\typeinfo.h(65) : error C2873: 'bad_typeid' : symbol cannot be used in a using-declaration
STLport\stlport\typeinfo.h(68) : error C2039: 'bad_cast' : is not a member of '`global namespace''
STLport\stlport\typeinfo.h(68) : error C2873: 'bad_cast' : symbol cannot be used in a using-declaration

This occured in production test, but not in the STLport test suite because the latter is missing this particular test case (please add).
Resolution is to make usings dependent on _STLP_HAS_NO_EXCEPTIONS because the two symbols are only relevant for the EH and RTTI case only.

Discussion

  • Just a note. It will be useful anyway for whoever meets these four of error messages reported above.

    It happens when in your code you type:
    #include "typeinfo.h"
    rather than:
    #include <typeinfo.h>