c++: visibility wrt template and ptrmem targs [PR70413]
commit7226f825db049517b64442a40a6387513febb8f9
authorPatrick Palka <ppalka@redhat.com>
Thu, 21 Dec 2023 18:53:43 +0000 (21 13:53 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 21 Dec 2023 18:53:43 +0000 (21 13:53 -0500)
tree0a8a02e95fe994c8c707d95695e4aaeb999d0a4e
parent135bb9e37167ef70501a888bd3db195b11b37ae3
c++: visibility wrt template and ptrmem targs [PR70413]

When constraining the visibility of an instantiation, we weren't
properly considering the visibility of PTRMEM_CST and TEMPLATE_DECL
template arguments.

This patch fixes this.  It turns out we don't maintain the relevant
visibility flags for alias templates (e.g. TREE_PUBLIC is never set),
so continue to ignore alias template template arguments for now.

PR c++/70413
PR c++/107906

gcc/cp/ChangeLog:

* decl2.cc (min_vis_expr_r): Handle PTRMEM_CST and TEMPLATE_DECL
other than those for alias templates.

gcc/testsuite/ChangeLog:

* g++.dg/template/linkage2.C: New test.
* g++.dg/template/linkage3.C: New test.
* g++.dg/template/linkage4.C: New test.
* g++.dg/template/linkage4a.C: New test.
gcc/cp/decl2.cc
gcc/testsuite/g++.dg/template/linkage2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/linkage3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/linkage4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/linkage4a.C [new file with mode: 0644]