Skip to content

<functional>: _HAS_STATIC_RTTI=0 shouldn't say typeid(void) #340

Description

We have a supported (obscure) mode _HAS_STATIC_RTTI=0 which disables most occurrences of typeid(Type). However, it says typeid(void) in a couple of places (I believe these are the only occurrences):

STL/stl/inc/functional

Lines 866 to 870 in 8f4c816

#if _HAS_STATIC_RTTI
return typeid(_Callable);
#else // _HAS_STATIC_RTTI
return typeid(void);
#endif // _HAS_STATIC_RTTI

STL/stl/inc/functional

Lines 930 to 934 in 8f4c816

#if _HAS_STATIC_RTTI
return typeid(_Callable);
#else // _HAS_STATIC_RTTI
return typeid(void);
#endif // _HAS_STATIC_RTTI

When I implemented this in April 2017, my checkin notes said:

We must provide virtuals, so make this one return typeid(void). (This is a single use of static RTTI, but always for the same type. I felt that this was superior to terminating.) typeid(void) is what's used for empty std::functions, so it's a reasonable return value.

It turns out that clang.exe has a mode, -fno-rtti, which makes typeid an error, even typeid(void). I believe we should change _HAS_STATIC_RTTI=0 to never say typeid(void).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething can be improvedfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions