aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-patterns.cc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-02-21 19:13:59 -0500
committerMarek Polacek <polacek@redhat.com>2023-02-28 10:15:27 -0500
commitd918c3a221434521f90cc9b63d5d87f5129e9231 (patch)
tree9ae4fb652e053a53ce4049cd42a6704e6fe8ba95 /gcc/tree-vect-patterns.cc
parentea718febab2a1f6e58806738abf70f1c73c6a308 (diff)
downloadgcc-d918c3a221434521f90cc9b63d5d87f5129e9231.zip
gcc-d918c3a221434521f90cc9b63d5d87f5129e9231.tar.gz
gcc-d918c3a221434521f90cc9b63d5d87f5129e9231.tar.bz2
c++: variable template and targ deduction [PR108550]
In this test, we get a bogus error because we failed to deduce the auto in constexpr auto is_pointer_v = is_pointer<Tp>::value; to bool. Then ensure_literal_type_for_constexpr_object thinks the object isn't literal and an error is reported. This is another case of the interaction between tf_partial and 'auto', where the auto was not reduced so the deduction failed. In more detail: we have Wrap1<int>() in the code and we need to perform OR -> fn_type_unification. The targ list is incomplete, so we do tsubst_flags_t ecomplain = complain | tf_partial | tf_fndecl_type; fntype = tsubst (TREE_TYPE (fn), explicit_targs, ecomplain, NULL_TREE); where TREE_TYPE (fn) is struct integral_constant <T402> (void). Then we substitute the return type, which results in tsubsting is_pointer_v<int>. is_pointer_v is a variable template with a placeholder type: template <class Tp> constexpr auto is_pointer_v = is_pointer<Tp>::value; so we find ourselves in lookup_and_finish_template_variable. tf_partial is still set, so finish_template_variable -> instantiate_template -> tsubst won't reduce the level of auto. But then we do mark_used which eventually calls do_auto_deduction which clears tf_partial, because we want to replace the auto now. But we hadn't reduced auto's level so this fails. And since we're not in an immediate context, we emit a hard error. I suppose that when we reach lookup_and_finish_template_variable it's probably time to clear tf_partial. (I added an assert and our testsuite doesn't have a test whereby we get to lookup_and_finish_template_variable while tf_partial is still active.) PR c++/108550 gcc/cp/ChangeLog: * pt.cc (lookup_and_finish_template_variable): Clear tf_partial. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ70.C: New test. * g++.dg/cpp1y/var-templ71.C: New test. * g++.dg/cpp1y/var-templ72.C: New test.
Diffstat (limited to 'gcc/tree-vect-patterns.cc')
0 files changed, 0 insertions, 0 deletions