GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
c++

c++: vrp and pmf conversion [PR126310]

Fixes incorrect type conversion for pointer-to-member-function conversions, resolving a compiler ICE.

This change corrects an error in C++ type conversion logic that led to incorrect handling of pointer-to-member-function types. Specifically, it ensures that conversions to a target type like void(sub::*)(int&&) are performed accurately, rather than to an unintended type like void(sub::*)(ValuePart&&). This fixes an optimizer confusion and resolves an internal compiler error (ICE) reported in PR126310.

In Details

The standard_conversion in cp/call.cc previously built a METHOD_TYPE that could be a mix of the correct parameter types and a VALUE_DEPENDENT_EXPR (VDE) related to a pointer-to-member-function (PMF). This caused issues with an optimization (r16-5887) during array initializers, as the RECORD_TYPEs of values differed from the array's actual type. The fix ensures the correct METHOD_TYPE is constructed, resolving the misconversion and subsequent ICE.

For Context
pointer-to-member-function (PMF)
A type in C++ that represents a pointer to a member function of a class. It can be used to refer to a specific member function and call it on an object of that class.
type conversion
The process of changing a value from one data type to another. In C++, this can be explicit (e.g., static_cast) or implicit, guided by language rules and compiler logic.
ICE (Internal Compiler Error)
An unrecoverable error encountered by the compiler during translation. It indicates a bug within the compiler itself, often triggered by complex or unusual code constructs.
array initializer
A construct used to initialize the elements of an array at the time of its declaration, typically using a list of values enclosed in braces.
Filed Under: c++compiler-errortype-conversion