diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-06-04 13:46:53 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-06-04 13:46:53 -0400 |
commit | 5357ab75dedef403b0eebf9277d61d1cbeb5898f (patch) | |
tree | 7e1596484feadf2d30015ee53f6fd2bc71ce0087 /gcc/tree-nested.c | |
parent | bee8619ad0ac3bd27b7c8dc5819b83a5e8e147a0 (diff) | |
download | gcc-5357ab75dedef403b0eebf9277d61d1cbeb5898f.zip gcc-5357ab75dedef403b0eebf9277d61d1cbeb5898f.tar.gz gcc-5357ab75dedef403b0eebf9277d61d1cbeb5898f.tar.bz2 |
c++: tsubst_function_decl and excess arg levels [PR100102]
Here, when instantiating the dependent alias template
duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
substituting the function decl _S_gcd. Since we have more arg levels
than _S_gcd has parm levels, an old special case in tsubst_function_decl
causes us to unwantedly reduce args to its innermost level, yielding
args={int}, which leads to a nonsensical substitution into the decl
context and eventually a crash.
The comment for this special case refers to three examples for which we
ought to see more arg levels than parm levels here, but none of the
examples actually demonstrate this. In the first example, when
defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
later when instantiating say S<int>::f<char> both depths are 2. In the
second example, when substituting the template friend declaration
parms_depth is 2 and args_depth is 1, and later when instantiating f
both depths are 1. Finally, the third example is invalid since we can't
specialize a member template of an unspecialized class template like
that.
Given that this reduction code seems no longer relevant for its
documented purpose and that it causes problems as in the PR, this patch
just removes it. Note that as far as bootstrap/regtest is concerned,
this code is dead; the below two tests would be the first to reach it.
PR c++/100102
gcc/cp/ChangeLog:
* pt.c (tsubst_function_decl): Remove old code for reducing
args when it has excess levels.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-72.C: New test.
* g++.dg/cpp0x/alias-decl-72a.C: New test.
Diffstat (limited to 'gcc/tree-nested.c')
0 files changed, 0 insertions, 0 deletions