C++: Fix function classification as immediate-escalating.
Correctly identifies functions that are not user-provided as immediate-escalating.
A function was being incorrectly classified as immediate-escalating in GCC’s C++ front-end. This issue stemmed from a misinterpretation of CWG 3153, which clarifies that non-user-provided functions defaulted on a declaration other than their first are considered user-provided. The fix ensures that the immediate_escalating_function_p check now correctly considers the user_provided_p status, aligning with the standard’s intent.
In Details
The cp-gimplify.cc function immediate_escalating_function_p incorrectly determined if a function should be escalated for immediate processing. According to CWG 3153, a function defaulted on a declaration other than its first is user-provided. The previous logic did not adequately account for this nuance, leading to misclassification. This patch updates the check to explicitly verify !user_provided_p before escalating, ensuring correct behavior for functions like defaulted constructors.
- immediate-escalating function
- A function whose definition or properties require immediate processing by the compiler, often related to language features like reflection or constexpr evaluation, to avoid potential ambiguities or errors.
- user-provided
- In C++, refers to a function or member that is explicitly defined by the programmer, as opposed to one that is implicitly generated or defaulted by the compiler.
- CWG 3153
- A defect report or issue (Core Working Group) from the C++ standards committee that clarifies specific language rules. This one pertains to the definition of 'user-provided' for defaulted functions.
- defaulted function
- A function (like a constructor or assignment operator) that is defined using the
= defaultspecifier. The compiler generates the default implementation for it.