C++/reflection: Propagate cv-qualifiers for SPLICE_SCOPE.
Fixes propagation of const/volatile qualifiers for SPLICE_SCOPE in C++ reflection.
The tsubst_splice_scope function wasn’t propagating cv-qualifiers (const/volatile) from the template tree to the result, causing assertion failures. This patch fixes this by adding the cv-quals, similar to other places in tsubst. This resolves PR125096.
In Details
The commit addresses an issue in C++ reflection where cv-qualifiers were not being correctly propagated during template substitution in tsubst_splice_scope. Specifically, when processing SPLICE_SCOPE, the code was returning early for dependent_splice_p and failing to propagate the cv-qualifiers from the SPLICE_SCOPE to the result. This patch fixes this by adding the missing qualifier propagation logic, ensuring assertions related to const correctness pass. Understanding of template substitution and C++ reflection internals (SPLICE_SCOPE) is crucial.
For Context
C++ reflection allows programs to examine and manipulate their own structure at runtime. Template metaprogramming allows you to write code that generates other code based on parameters given at compile time. This commit fixes a bug in how the compiler handles const and volatile qualifiers (which control whether a variable can be changed) when using these advanced features together, ensuring that the generated code correctly respects the qualifiers.