C++ Modules: Fix merging of member functions
Declaration merging now considers whether a member function has an implicit or explicit object parameter to avoid ICEs.
The C++ module merging process in GCC could ICE during declaration merging of static member functions. The merge key lacked sufficient information to differentiate between overloads differing only by the presence of an object parameter. This patch adds iobj_p and xobj_p bits to the merge key to resolve this ambiguity, fixing the ICE. New test cases are added.
In Details
The GCC C++ frontend's module implementation (module.cc) uses merge keys to determine if two declarations from different translation units can be merged. This patch enhances the merge key for FUNCTION_DECLs by adding flags for implicit and explicit object parameters (iobj_p, xobj_p) to resolve ambiguities that arise during lookup and instantiation.
For Context
C++ modules are a way to organize code into reusable units, similar to header files, but with improved dependency management and build times. When using modules, the compiler needs to merge declarations of the same entity that are spread across different module files. This process involves comparing the declarations to ensure they are compatible and can be combined correctly.