Skip to content

[clang] typeid() can only be used with <typeinfo> #162758

@mikomikotaishi

Description

@mikomikotaishi

When compiling a translation unit that calls the typeid() operator, the compiler will compile the file only if <typeinfo> is #included. It will not compile when using import std; (or any module that re-exports std::type_info), for example, without any #include <typeinfo>.

I imagine this is not intended, as cppreference states that a program is ill-informed if it calls typeid() without std::type_info being visible, if a translation imports a module that re-exports std::type_info, it should in theory still work, yet it does not.

Metadata

Metadata

Assignees

Labels

clang:modulesC++20 modules and Clang Header Modules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions