aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-12-20 11:09:11 -0500
committerPatrick Palka <ppalka@redhat.com>2022-12-20 11:09:11 -0500
commit49b6b7ac3314843466395c4a194aa178c80e64f5 (patch)
tree72467648d5a3621aa22f50f9bb987f3f69d26ece /gcc/tree.cc
parent0bdd2261c254f08b0f4437c156b79711d68c6e7f (diff)
downloadgcc-49b6b7ac3314843466395c4a194aa178c80e64f5.zip
gcc-49b6b7ac3314843466395c4a194aa178c80e64f5.tar.gz
gcc-49b6b7ac3314843466395c4a194aa178c80e64f5.tar.bz2
c++: NTTP object wrapper substitution fixes [PR103346, ...]
This patch fixes some issues with substitution into a C++20 template parameter object wrapper: * The first testcase demonstrates a situation where the same_type_p assert in relevant case of tsubst_copy doesn't hold, because (partial) substitution of {int,} into the wrapper's TREE_TYPE yields A<int> but substitution into the underlying TEMPLATE_PARM_INDEX is a nop due to tsubst's level==1/tf_partial early exit tests, hence TREE_TYPE in the latter case remains A<T>. So this patch just gets rid of the assert; the type mismatch doesn't seem to be a problem in practice. * In the second testcase, dependent substitution into the underlying TEMPLATE_PARM_INDEX yields a CALL_EXPR with empty TREE_TYPE, which tsubst_copy doesn't expect. This patch fixes this by handling empty TREE_TYPE the same way as a non-const TREE_TYPE. Moreover, after this substitution we're left with a VIEW_CONVERT_EXPR wrapping a CALL_EXPR instead of a TEMPLATE_PARM_INDEX, which during the subsequent non-dependent substitution tsubst_copy doesn't expect either. So this patch also relaxes tsubst_copy to accept such VIEW_CONVERT_EXPR too. * In the third testcase, we end up never resolving the call to f.modify() because tsubst_copy doesn't do overload resolution. This patch fixes this by moving the handling of these VIEW_CONVERT_EXPR wrappers from tsubst_copy to tsubst_copy_and_build. For good measure tsubst_copy_and_build should also handle REF_PARENTHESIZED_P wrappers instead of delegating to tsubst_copy. PR c++/103346 PR c++/104278 PR c++/102553 gcc/cp/ChangeLog: * pt.cc (tsubst_copy) <case VIEW_CONVERT_EXPR>: Move the handling of C++20 template parameter object wrappers to ... (tsubst_copy_and_build) <case VIEW_CONVERT_EXPR>: ... here. Accept non-TEMPLATE_PARM_INDEX inner operand. Handle empty TREE_TYPE on substituted inner operand. Remove same_type_p assert. Also handle REF_PARENTHESIZED_P VIEW_CONVERT_EXPRs. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class52a.C: New test. * g++.dg/cpp2a/nontype-class53.C: New test. * g++.dg/cpp2a/nontype-class54.C: New test. * g++.dg/cpp2a/nontype-class55.C: New test.
Diffstat (limited to 'gcc/tree.cc')
0 files changed, 0 insertions, 0 deletions