GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/cp

c++: Remove can_convert_eh, favoring handler_match_for_exception_type

Removes redundant `can_convert_eh` C++ function, simplifying exception handling logic.

The C++ compiler has removed the can_convert_eh function, which performed a similar check to the more modern handler_match_for_exception_type. The latter function aligns better with the C++ standard and has been updated to handle missing ba_ignore_scope lookup and pointer types. This change simplifies the exception handling code by eliminating the older, less-standard function.

In Details

GCC's exception handling infrastructure previously had two functions for determining if an exception type could be handled: can_convert_eh and handler_match_for_exception_type. The latter is preferred as it more accurately reflects the C++ standard's rules for exception matching, particularly concerning derived types and virtual inheritance. This commit removes can_convert_eh and updates call sites to use handler_match_for_exception_type. Minor fixes were applied to handler_match_for_exception_type to correctly handle lookups in private base classes and for pointer types, ensuring n…

For Context
exception handling
A control flow mechanism in programming languages used to respond to errors or exceptional conditions that occur during program execution.
derived type
In C++, a type that is defined in terms of another type (the base type). It inherits members from the base type.
virtual inheritance
A C++ feature used in multiple inheritance scenarios to prevent the 'diamond problem,' ensuring that a base class is included only once in a derived class.
pointer type
In C++, a type that refers to the memory address of another variable.
ba_ignore_scope
A flag or option related to scope resolution during lookup operations in C++, possibly indicating that certain scope-related checks should be ignored.
Filed Under: c++exception handlingrefactor