C++: Always Walk DECL_VALUE_EXPR in cp_genericize_r
cp_genericize_r now always walks DECL_VALUE_EXPR, fixing a potential issue during template instantiation.
This commit modifies cp_genericize_r to unconditionally walk DECL_VALUE_EXPR. This change, based on a previous TODO, ensures that template instantiations involving DECL_VALUE_EXPR are handled correctly. This ensures consistent processing of C++ code involving template instantiation.
In Details
cp_genericize_r is the recursive function responsible for genericizing C++ code during template instantiation. DECL_VALUE_EXPR represents an expression that yields the value of a declaration. This patch ensures that cp_genericize_r always traverses DECL_VALUE_EXPR nodes, ensuring correct handling of value expressions within templates. Related to PR c++/121500.
For Context
In C++, templates allow writing code that can work with different data types. During compilation, when a template is used with a specific type, it needs to be "instantiated" for that type. cp_genericize_r is part of the process that adapts the template code to the specific data type. DECL_VALUE_EXPR represents an expression whose value is a declared variable or constant. With this change, the compiler now consistently handles these expressions inside templates during the instantiation process.