Skip to content

Commit 9583f78

Browse files
author
Patrick Palka
committed
c++: visibility wrt concept-id as targ [PR115283]
Like with alias templates, it seems we don't maintain visibility flags for concepts either, so min_vis_expr_r should ignore them for now. Otherwise after r14-6789 we may incorrectly give a function template that uses a concept-id in its signature internal linkage. PR c++/115283 gcc/cp/ChangeLog: * decl2.cc (min_vis_expr_r) <case TEMPLATE_DECL>: Ignore concepts. gcc/testsuite/ChangeLog: * g++.dg/template/linkage5.C: New test. Reviewed-by: Jason Merrill <[email protected]> (cherry picked from commit b1fe718)
1 parent 0ed63e3 commit 9583f78

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

gcc/cp/decl2.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,9 +2710,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
27102710
break;
27112711

27122712
case TEMPLATE_DECL:
2713-
if (DECL_ALIAS_TEMPLATE_P (t))
2713+
if (DECL_ALIAS_TEMPLATE_P (t) || standard_concept_p (t))
27142714
/* FIXME: We don't maintain TREE_PUBLIC / DECL_VISIBILITY for
2715-
alias templates so we can't trust it here (PR107906). */
2715+
alias templates so we can't trust it here (PR107906). Ditto
2716+
for concepts. */
27162717
break;
27172718
t = DECL_TEMPLATE_RESULT (t);
27182719
/* Fall through. */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// PR c++/115283
2+
// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fIiEv1AIX1CIT_EEE" } }
3+
// { dg-do compile { target c++20 } }
4+
5+
template<class T>
6+
concept C = true;
7+
8+
template<bool B>
9+
struct A { };
10+
11+
template<class T>
12+
void f(A<C<T>>) { }
13+
14+
template void f<int>(A<true>);

0 commit comments

Comments
 (0)