C++ compiler fixes tsubst_splice_expr for PR127276.
Corrects the C++ compiler's handling of splice expressions in templates to properly convert references.
This commit fixes a bug in GCC’s C++ frontend where splice expressions used within templates were not being correctly processed. Specifically, the compiler failed to call convert_from_reference for PARM_DECLs of REFERENCE_TYPE, leading to incorrect calls to build_x_array_ref. The fix ensures convert_from_reference is called, resolving the issue and allowing a new test case to pass.
In Details
Within GCC's C++ frontend (pt.cc), the tsubst_splice_expr function handles template argument substitution for splice expressions. When parsing splice expressions outside of templates, the finish_id_expression path correctly invokes convert_from_reference. However, within tsubst_splice_expr, this conversion was omitted for PARM_DECLs of REFERENCE_TYPE, causing build_x_array_ref to be called with incorrect types instead of indirect references. This patch inserts the missing convert_from_reference call, aligning the template substitution logic with the non-template path.
- tsubst_splice_expr
- A function within GCC's C++ frontend that handles the substitution of template arguments for splice expressions.
- template argument substitution
- The process by which a compiler replaces placeholder template parameters with actual types or values provided when a template is instantiated.
- PARM_DECL
- A GCC internal representation node (declaration) for a function parameter.
- REFERENCE_TYPE
- An internal GCC type representing a C++ reference (e.g., 'int&').
- INDIRECT_REF
- An internal GCC representation for dereferencing a pointer or reference.
- build_x_array_ref
- A GCC internal function used to construct an expression representing an array reference (e.g., 'arr[index]').