public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++: visibility wrt template and ptrmem targs [PR70413]
@ 2023-09-15 16:03 Patrick Palka
  2023-09-16 20:27 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Palka @ 2023-09-15 16:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, Patrick Palka

Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
trunk?

-- >8 --

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

	PR c++/70413

gcc/cp/ChangeLog:

	* decl2.cc (min_vis_expr_r): Handle PTRMEM_CST and TEMPLATE_DECL.

gcc/testsuite/ChangeLog:

	* g++.dg/abi/no-linkage-expr2.C: New test.
	* g++.dg/abi/no-linkage-expr3.C: New test.
---
 gcc/cp/decl2.cc                             | 18 ++++++++++++++----
 gcc/testsuite/g++.dg/abi/no-linkage-expr2.C | 15 +++++++++++++++
 gcc/testsuite/g++.dg/abi/no-linkage-expr3.C | 17 +++++++++++++++++
 3 files changed, 46 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
 create mode 100644 gcc/testsuite/g++.dg/abi/no-linkage-expr3.C

diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index b402befba6d..5006372a646 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -2582,7 +2582,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
   int *vis_p = (int *)data;
   int tpvis = VISIBILITY_DEFAULT;
 
-  switch (TREE_CODE (*tp))
+  tree t = *tp;
+  if (TREE_CODE (t) == PTRMEM_CST)
+    t = PTRMEM_CST_MEMBER (t);
+  switch (TREE_CODE (t))
     {
     case CAST_EXPR:
     case IMPLICIT_CONV_EXPR:
@@ -2593,15 +2596,22 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
     case NEW_EXPR:
     case CONSTRUCTOR:
     case LAMBDA_EXPR:
-      tpvis = type_visibility (TREE_TYPE (*tp));
+      tpvis = type_visibility (TREE_TYPE (t));
       break;
 
+    case TEMPLATE_DECL:
+      t = DECL_TEMPLATE_RESULT (t);
+      /* Fall through.  */
     case VAR_DECL:
     case FUNCTION_DECL:
-      if (! TREE_PUBLIC (*tp))
+      if (! TREE_PUBLIC (t))
 	tpvis = VISIBILITY_ANON;
       else
-	tpvis = DECL_VISIBILITY (*tp);
+	tpvis = DECL_VISIBILITY (t);
+      break;
+
+    case FIELD_DECL:
+      tpvis = type_visibility (DECL_CONTEXT (t));
       break;
 
     default:
diff --git a/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C b/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
new file mode 100644
index 00000000000..db23570bb08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
@@ -0,0 +1,15 @@
+// PR c++/70413
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler-not "weak.*_Z" } }
+
+namespace {
+  template<class> struct A;
+  template<class> using B = int;
+}
+
+template<template<class> class Q> void f() { }
+
+int main() {
+  f<A>();
+  f<B>();
+}
diff --git a/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C b/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C
new file mode 100644
index 00000000000..a2db1a45c74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C
@@ -0,0 +1,17 @@
+// PR c++/70413
+// { dg-final { scan-assembler-not "weak.*_Z" } }
+
+namespace {
+  struct A {
+    void f();
+    int m;
+  };
+}
+
+template<void(A::*)()> void g() { }
+template<int A::*> void h() { }
+
+int main() {
+  g<&A::f>();
+  h<&A::m>();
+}
-- 
2.42.0.158.g94e83dcf5b


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++: visibility wrt template and ptrmem targs [PR70413]
  2023-09-15 16:03 [PATCH] c++: visibility wrt template and ptrmem targs [PR70413] Patrick Palka
@ 2023-09-16 20:27 ` Jason Merrill
  2023-12-21 19:12   ` Patrick Palka
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2023-09-16 20:27 UTC (permalink / raw)
  To: Patrick Palka, gcc-patches

On 9/15/23 12:03, Patrick Palka wrote:
> Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
> trunk?

OK.

> -- >8 --
> 
> When constraining the visibility of an instantiation, we weren't
> properly considering the visibility of PTRMEM_CST and TEMPLATE_DECL
> template arguments.
> 
> 	PR c++/70413
> 
> gcc/cp/ChangeLog:
> 
> 	* decl2.cc (min_vis_expr_r): Handle PTRMEM_CST and TEMPLATE_DECL.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/abi/no-linkage-expr2.C: New test.
> 	* g++.dg/abi/no-linkage-expr3.C: New test.
> ---
>   gcc/cp/decl2.cc                             | 18 ++++++++++++++----
>   gcc/testsuite/g++.dg/abi/no-linkage-expr2.C | 15 +++++++++++++++
>   gcc/testsuite/g++.dg/abi/no-linkage-expr3.C | 17 +++++++++++++++++
>   3 files changed, 46 insertions(+), 4 deletions(-)
>   create mode 100644 gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
>   create mode 100644 gcc/testsuite/g++.dg/abi/no-linkage-expr3.C
> 
> diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
> index b402befba6d..5006372a646 100644
> --- a/gcc/cp/decl2.cc
> +++ b/gcc/cp/decl2.cc
> @@ -2582,7 +2582,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
>     int *vis_p = (int *)data;
>     int tpvis = VISIBILITY_DEFAULT;
>   
> -  switch (TREE_CODE (*tp))
> +  tree t = *tp;
> +  if (TREE_CODE (t) == PTRMEM_CST)
> +    t = PTRMEM_CST_MEMBER (t);
> +  switch (TREE_CODE (t))
>       {
>       case CAST_EXPR:
>       case IMPLICIT_CONV_EXPR:
> @@ -2593,15 +2596,22 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
>       case NEW_EXPR:
>       case CONSTRUCTOR:
>       case LAMBDA_EXPR:
> -      tpvis = type_visibility (TREE_TYPE (*tp));
> +      tpvis = type_visibility (TREE_TYPE (t));
>         break;
>   
> +    case TEMPLATE_DECL:
> +      t = DECL_TEMPLATE_RESULT (t);
> +      /* Fall through.  */
>       case VAR_DECL:
>       case FUNCTION_DECL:
> -      if (! TREE_PUBLIC (*tp))
> +      if (! TREE_PUBLIC (t))
>   	tpvis = VISIBILITY_ANON;
>         else
> -	tpvis = DECL_VISIBILITY (*tp);
> +	tpvis = DECL_VISIBILITY (t);
> +      break;
> +
> +    case FIELD_DECL:
> +      tpvis = type_visibility (DECL_CONTEXT (t));
>         break;
>   
>       default:
> diff --git a/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C b/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
> new file mode 100644
> index 00000000000..db23570bb08
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/abi/no-linkage-expr2.C
> @@ -0,0 +1,15 @@
> +// PR c++/70413
> +// { dg-do compile { target c++11 } }
> +// { dg-final { scan-assembler-not "weak.*_Z" } }
> +
> +namespace {
> +  template<class> struct A;
> +  template<class> using B = int;
> +}
> +
> +template<template<class> class Q> void f() { }
> +
> +int main() {
> +  f<A>();
> +  f<B>();
> +}
> diff --git a/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C b/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C
> new file mode 100644
> index 00000000000..a2db1a45c74
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/abi/no-linkage-expr3.C
> @@ -0,0 +1,17 @@
> +// PR c++/70413
> +// { dg-final { scan-assembler-not "weak.*_Z" } }
> +
> +namespace {
> +  struct A {
> +    void f();
> +    int m;
> +  };
> +}
> +
> +template<void(A::*)()> void g() { }
> +template<int A::*> void h() { }
> +
> +int main() {
> +  g<&A::f>();
> +  h<&A::m>();
> +}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++: visibility wrt template and ptrmem targs [PR70413]
  2023-09-16 20:27 ` Jason Merrill
@ 2023-12-21 19:12   ` Patrick Palka
  2023-12-21 20:39     ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Palka @ 2023-12-21 19:12 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Patrick Palka, gcc-patches

On Sat, 16 Sep 2023, Jason Merrill wrote:

> On 9/15/23 12:03, Patrick Palka wrote:
> > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
> > trunk?
> 
> OK.

Thanks a lot.  Testing on cmcstl2 revealed that we don't maintain
visibility flags on alias templates properly, and so we can't trust
them when constraining visibilitiy.  So I went ahead and pushed the
following restricted version of the patch which excludes alias templates
(and adds a couple of alias template targ linkage tests):

-- >8 --

Subject: [PATCH] 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                           | 22 ++++++++++++++++++----
 gcc/testsuite/g++.dg/template/linkage2.C  | 13 +++++++++++++
 gcc/testsuite/g++.dg/template/linkage3.C  | 17 +++++++++++++++++
 gcc/testsuite/g++.dg/template/linkage4.C  | 16 ++++++++++++++++
 gcc/testsuite/g++.dg/template/linkage4a.C | 14 ++++++++++++++
 5 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/template/linkage2.C
 create mode 100644 gcc/testsuite/g++.dg/template/linkage3.C
 create mode 100644 gcc/testsuite/g++.dg/template/linkage4.C
 create mode 100644 gcc/testsuite/g++.dg/template/linkage4a.C

diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 0850d3f5bce..4777ceb8af7 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -2655,7 +2655,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
   int *vis_p = (int *)data;
   int tpvis = VISIBILITY_DEFAULT;
 
-  switch (TREE_CODE (*tp))
+  tree t = *tp;
+  if (TREE_CODE (t) == PTRMEM_CST)
+    t = PTRMEM_CST_MEMBER (t);
+  switch (TREE_CODE (t))
     {
     case CAST_EXPR:
     case IMPLICIT_CONV_EXPR:
@@ -2666,15 +2669,26 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
     case NEW_EXPR:
     case CONSTRUCTOR:
     case LAMBDA_EXPR:
-      tpvis = type_visibility (TREE_TYPE (*tp));
+      tpvis = type_visibility (TREE_TYPE (t));
       break;
 
+    case TEMPLATE_DECL:
+      if (DECL_ALIAS_TEMPLATE_P (t))
+	/* FIXME: We don't maintain TREE_PUBLIC / DECL_VISIBILITY for
+	   alias templates so we can't trust it here (PR107906).  */
+	break;
+      t = DECL_TEMPLATE_RESULT (t);
+      /* Fall through.  */
     case VAR_DECL:
     case FUNCTION_DECL:
-      if (! TREE_PUBLIC (*tp))
+      if (! TREE_PUBLIC (t))
 	tpvis = VISIBILITY_ANON;
       else
-	tpvis = DECL_VISIBILITY (*tp);
+	tpvis = DECL_VISIBILITY (t);
+      break;
+
+    case FIELD_DECL:
+      tpvis = type_visibility (DECL_CONTEXT (t));
       break;
 
     default:
diff --git a/gcc/testsuite/g++.dg/template/linkage2.C b/gcc/testsuite/g++.dg/template/linkage2.C
new file mode 100644
index 00000000000..08fb6930262
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/linkage2.C
@@ -0,0 +1,13 @@
+// PR c++/70413
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" } }
+
+namespace {
+  template<class> struct A;
+}
+
+template<template<class> class Q> void f() { }
+
+int main() {
+  f<A>();
+}
diff --git a/gcc/testsuite/g++.dg/template/linkage3.C b/gcc/testsuite/g++.dg/template/linkage3.C
new file mode 100644
index 00000000000..257aab33b38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/linkage3.C
@@ -0,0 +1,17 @@
+// PR c++/70413
+// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" } }
+
+namespace {
+  struct A {
+    void f();
+    int m;
+  };
+}
+
+template<void(A::*)()> void g() { }
+template<int A::*> void h() { }
+
+int main() {
+  g<&A::f>();
+  h<&A::m>();
+}
diff --git a/gcc/testsuite/g++.dg/template/linkage4.C b/gcc/testsuite/g++.dg/template/linkage4.C
new file mode 100644
index 00000000000..03630eebd3d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/linkage4.C
@@ -0,0 +1,16 @@
+// PR c++/107906
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" { xfail *-*-* } } }
+
+namespace {
+  template<class> using X = int;
+  struct A {
+    template<class> using X = int;
+  };
+}
+template<template<class> class Q> void f() { }
+
+int main() {
+  f<X>();
+  f<A::X>();
+}
diff --git a/gcc/testsuite/g++.dg/template/linkage4a.C b/gcc/testsuite/g++.dg/template/linkage4a.C
new file mode 100644
index 00000000000..f1934fd6557
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/linkage4a.C
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fI1XEvv" } }
+// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fIN1A1XEEvv" } }
+
+template<class> using X = int;
+struct A {
+  template<class> using X = int;
+};
+template<template<class> class Q> void f() { }
+
+int main() {
+  f<X>();
+  f<A::X>();
+}
-- 
2.43.0.174.g055bb6e996


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] c++: visibility wrt template and ptrmem targs [PR70413]
  2023-12-21 19:12   ` Patrick Palka
@ 2023-12-21 20:39     ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2023-12-21 20:39 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches

On 12/21/23 14:12, Patrick Palka wrote:
> On Sat, 16 Sep 2023, Jason Merrill wrote:
> 
>> On 9/15/23 12:03, Patrick Palka wrote:
>>> Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
>>> trunk?
>>
>> OK.
> 
> Thanks a lot.  Testing on cmcstl2 revealed that we don't maintain
> visibility flags on alias templates properly, and so we can't trust
> them when constraining visibilitiy.  So I went ahead and pushed the
> following restricted version of the patch which excludes alias templates
> (and adds a couple of alias template targ linkage tests):

OK.

> -- >8 --
> 
> Subject: [PATCH] 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                           | 22 ++++++++++++++++++----
>   gcc/testsuite/g++.dg/template/linkage2.C  | 13 +++++++++++++
>   gcc/testsuite/g++.dg/template/linkage3.C  | 17 +++++++++++++++++
>   gcc/testsuite/g++.dg/template/linkage4.C  | 16 ++++++++++++++++
>   gcc/testsuite/g++.dg/template/linkage4a.C | 14 ++++++++++++++
>   5 files changed, 78 insertions(+), 4 deletions(-)
>   create mode 100644 gcc/testsuite/g++.dg/template/linkage2.C
>   create mode 100644 gcc/testsuite/g++.dg/template/linkage3.C
>   create mode 100644 gcc/testsuite/g++.dg/template/linkage4.C
>   create mode 100644 gcc/testsuite/g++.dg/template/linkage4a.C
> 
> diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
> index 0850d3f5bce..4777ceb8af7 100644
> --- a/gcc/cp/decl2.cc
> +++ b/gcc/cp/decl2.cc
> @@ -2655,7 +2655,10 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
>     int *vis_p = (int *)data;
>     int tpvis = VISIBILITY_DEFAULT;
>   
> -  switch (TREE_CODE (*tp))
> +  tree t = *tp;
> +  if (TREE_CODE (t) == PTRMEM_CST)
> +    t = PTRMEM_CST_MEMBER (t);
> +  switch (TREE_CODE (t))
>       {
>       case CAST_EXPR:
>       case IMPLICIT_CONV_EXPR:
> @@ -2666,15 +2669,26 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data)
>       case NEW_EXPR:
>       case CONSTRUCTOR:
>       case LAMBDA_EXPR:
> -      tpvis = type_visibility (TREE_TYPE (*tp));
> +      tpvis = type_visibility (TREE_TYPE (t));
>         break;
>   
> +    case TEMPLATE_DECL:
> +      if (DECL_ALIAS_TEMPLATE_P (t))
> +	/* FIXME: We don't maintain TREE_PUBLIC / DECL_VISIBILITY for
> +	   alias templates so we can't trust it here (PR107906).  */
> +	break;
> +      t = DECL_TEMPLATE_RESULT (t);
> +      /* Fall through.  */
>       case VAR_DECL:
>       case FUNCTION_DECL:
> -      if (! TREE_PUBLIC (*tp))
> +      if (! TREE_PUBLIC (t))
>   	tpvis = VISIBILITY_ANON;
>         else
> -	tpvis = DECL_VISIBILITY (*tp);
> +	tpvis = DECL_VISIBILITY (t);
> +      break;
> +
> +    case FIELD_DECL:
> +      tpvis = type_visibility (DECL_CONTEXT (t));
>         break;
>   
>       default:
> diff --git a/gcc/testsuite/g++.dg/template/linkage2.C b/gcc/testsuite/g++.dg/template/linkage2.C
> new file mode 100644
> index 00000000000..08fb6930262
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/template/linkage2.C
> @@ -0,0 +1,13 @@
> +// PR c++/70413
> +// { dg-do compile { target c++11 } }
> +// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" } }
> +
> +namespace {
> +  template<class> struct A;
> +}
> +
> +template<template<class> class Q> void f() { }
> +
> +int main() {
> +  f<A>();
> +}
> diff --git a/gcc/testsuite/g++.dg/template/linkage3.C b/gcc/testsuite/g++.dg/template/linkage3.C
> new file mode 100644
> index 00000000000..257aab33b38
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/template/linkage3.C
> @@ -0,0 +1,17 @@
> +// PR c++/70413
> +// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" } }
> +
> +namespace {
> +  struct A {
> +    void f();
> +    int m;
> +  };
> +}
> +
> +template<void(A::*)()> void g() { }
> +template<int A::*> void h() { }
> +
> +int main() {
> +  g<&A::f>();
> +  h<&A::m>();
> +}
> diff --git a/gcc/testsuite/g++.dg/template/linkage4.C b/gcc/testsuite/g++.dg/template/linkage4.C
> new file mode 100644
> index 00000000000..03630eebd3d
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/template/linkage4.C
> @@ -0,0 +1,16 @@
> +// PR c++/107906
> +// { dg-do compile { target c++11 } }
> +// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" { xfail *-*-* } } }
> +
> +namespace {
> +  template<class> using X = int;
> +  struct A {
> +    template<class> using X = int;
> +  };
> +}
> +template<template<class> class Q> void f() { }
> +
> +int main() {
> +  f<X>();
> +  f<A::X>();
> +}
> diff --git a/gcc/testsuite/g++.dg/template/linkage4a.C b/gcc/testsuite/g++.dg/template/linkage4a.C
> new file mode 100644
> index 00000000000..f1934fd6557
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/template/linkage4a.C
> @@ -0,0 +1,14 @@
> +// { dg-do compile { target c++11 } }
> +// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fI1XEvv" } }
> +// { dg-final { scan-assembler "(weak|glob)\[^\n\]*_Z1fIN1A1XEEvv" } }
> +
> +template<class> using X = int;
> +struct A {
> +  template<class> using X = int;
> +};
> +template<template<class> class Q> void f() { }
> +
> +int main() {
> +  f<X>();
> +  f<A::X>();
> +}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-21 20:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 16:03 [PATCH] c++: visibility wrt template and ptrmem targs [PR70413] Patrick Palka
2023-09-16 20:27 ` Jason Merrill
2023-12-21 19:12   ` Patrick Palka
2023-12-21 20:39     ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).