This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

typeid name of non-throwing function type


I see with any recent GCC (when targeting the Itanium C++ ABI),

$ cat test.cc
#include <iostream>
#include <typeinfo>
void f() noexcept;
int main() { std::cout << typeid(f).name() << '\n'; }

$ g++ -std=c++17 test.cc
$ ./a.out
FvvE

that the function type's mangling doesn't contain the noexcept specifier (in which case it would be "DoFvvE").

Is that a deliberate decision in GCC, or does it just happen by accident (as for function pointer types, the Itanium ABI encodes noexcept specifiers at the __pointer_type_info, not at the underlying __function_type_info)?

I'm asking in the context of Clang patch <https://reviews.llvm.org/D40720> "No -fsanitize=function warning when calling noexcept function through non-noexcept pointer in C++17". Clang happens to produce type_info for the noexcept-annotated function type (with "DoFvvE" name) in the above example, and not doing so (and instead behaving like GCC does) would be one way to solve the issue I want to fix with that patch.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]