]> gcc.gnu.org Git - gcc.git/commit
c++ modules: variable template partial spec fixes [PR107033]
authorPatrick Palka <ppalka@redhat.com>
Mon, 26 Sep 2022 15:30:17 +0000 (11:30 -0400)
committerPatrick Palka <ppalka@redhat.com>
Mon, 26 Sep 2022 15:30:17 +0000 (11:30 -0400)
commit099a66498bf7a40764002793eba66c881a251b76
tree4876e589390d43536b3b6e227fbb6ed9f54a18e1
parent1b5432b401934962affe32cd7e42e864224e8062
c++ modules: variable template partial spec fixes [PR107033]

In r13-2775-g32d8123cd6ce87 I missed that we need to adjust the call to
add_mergeable_specialization in the MK_partial case to correctly handle
variable template partial specializations (it currently assumes we're
always dealing with one for a class template).  This fixes an ICE when
converting the testcase from that commit to use an importable header
instead of a named module.

PR c++/107033

gcc/cp/ChangeLog:

* module.cc (trees_in::decl_value): In the MK_partial case for
a variable template partial specialization, pass decl_p=true to
add_mergeable_specialization, and set spec to the VAR_DECL not
the TEMPLATE_DECL.
* pt.cc (add_mergeable_specialization): For a variable template
partial specialization, set the TREE_TYPE of the new
DECL_TEMPLATE_SPECIALIZATIONS node to the TREE_TYPE of the
VAR_DECL not the VAR_DECL itself.

gcc/testsuite/ChangeLog:

* g++.dg/modules/partial-2.cc, g++.dg/modules/partial-2.h: New
files, factored out from ...
* g++.dg/modules/partial-2_a.C, g++.dg/modules/partial-2_b.C: ...
these.
* g++.dg/modules/partial-2_c.H: New test.
* g++.dg/modules/partial-2_d.C: New test.
gcc/cp/module.cc
gcc/cp/pt.cc
gcc/testsuite/g++.dg/modules/partial-2.cc [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-2.h [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-2_a.C
gcc/testsuite/g++.dg/modules/partial-2_b.C
gcc/testsuite/g++.dg/modules/partial-2_c.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/partial-2_d.C [new file with mode: 0644]
This page took 0.059 seconds and 5 git commands to generate.