diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-07-10 10:59:40 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-07-10 10:59:40 -0400 |
commit | 2c60368ab5706a870a1a3be190acc4d673672c30 (patch) | |
tree | 3612bc4c1fb1bec75499694459c2c357b43f0ab4 /gcc/cp | |
parent | 1e2e5713a6dbd36ac48e8cf78f0eeb303d820afe (diff) | |
download | gcc-2c60368ab5706a870a1a3be190acc4d673672c30.zip gcc-2c60368ab5706a870a1a3be190acc4d673672c30.tar.gz gcc-2c60368ab5706a870a1a3be190acc4d673672c30.tar.bz2 |
c++: redeclare_class_template and ttps [PR110523]
Now that we cache level-lowered ttps we can end up processing the same
ttp multiple times via (multiple calls to) redeclare_class_template, so
we can't assume a ttp's DECL_CONTEXT is initially empty.
PR c++/110523
gcc/cp/ChangeLog:
* pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
assert, and downgrade it to a checking assert.
gcc/testsuite/ChangeLog:
* g++.dg/template/ttp37.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/pt.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index d7d774f..076f788 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -6388,7 +6388,8 @@ redeclare_class_template (tree type, tree parms, tree cons) DECL_CONTEXT of the template for which they are a parameter. */ if (TREE_CODE (parm) == TEMPLATE_DECL) { - gcc_assert (DECL_CONTEXT (parm) == NULL_TREE); + gcc_checking_assert (DECL_CONTEXT (parm) == NULL_TREE + || DECL_CONTEXT (parm) == tmpl); DECL_CONTEXT (parm) = tmpl; } } |