[pushed] c++: add fixed testcase [PR111682]

Message ID 20240216174518.455856-1-ppalka@redhat.com
State Committed
Commit c95dc611a6203f0564722975acff4ad866b9c45e
Headers
Series [pushed] c++: add fixed testcase [PR111682] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Patrick Palka Feb. 16, 2024, 5:45 p.m. UTC
  Fixed by the PR113612 fix r14-8960-g19ac327de421fe.

	PR c++/111682

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/var-templ86.C: New test.
---
 gcc/testsuite/g++.dg/cpp1y/var-templ86.C | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ86.C
  

Patch

diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ86.C b/gcc/testsuite/g++.dg/cpp1y/var-templ86.C
new file mode 100644
index 00000000000..0c933cac26c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ86.C
@@ -0,0 +1,23 @@ 
+// PR c++/111682
+// { dg-do compile { target c++14 } }
+
+template<typename T> struct A {
+  template<typename U> struct B;
+  template<typename U> struct B<U*>;
+};
+template<typename T> template<typename U> struct A<T>::B<U*> {};
+template struct A<int>;
+A<int>::B<int*> b;
+
+
+template<typename T> struct B {
+  template<typename U> static const int var1;
+  template<typename U> static const int var1<U*>;
+
+  template<typename U> static const int var2;
+};
+template<typename T> template<typename U> const int B<T>::var1<U*> = 1;
+template<typename T> template<typename U> const int B<T>::var2<U*> = 1;
+template struct B<int>;
+int b_test1[B<int>::var1<int*>];
+int b_test2[B<int>::var2<int*>];