diff mbox series

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

Message ID 20240719150904.2079000-1-ppalka@redhat.com
State New
Headers show
Series [pushed] c++: add fixed testcase [PR109464] | expand

Commit Message

Patrick Palka July 19, 2024, 3:09 p.m. UTC
Seems to be fixed by r15-521-g6ad7ca1bb90573.

	PR c++/109464

gcc/testsuite/ChangeLog:

	* g++.dg/template/explicit-instantiation8.C: New test.
---
 .../g++.dg/template/explicit-instantiation8.C | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/template/explicit-instantiation8.C
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/template/explicit-instantiation8.C b/gcc/testsuite/g++.dg/template/explicit-instantiation8.C
new file mode 100644
index 00000000000..92152a2992e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/explicit-instantiation8.C
@@ -0,0 +1,24 @@ 
+// PR c++/109464
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct shallow
+ {
+   int len;
+   constexpr shallow() : len(0) { }
+  };
+
+template<typename T>
+struct use_shallow
+  {
+   static constexpr shallow<T> s_zstr = { };
+   static_assert(s_zstr.len == 0, "");
+  };
+
+extern template struct shallow<char>;
+extern template struct use_shallow<char>;
+
+template struct shallow<char>;
+template struct use_shallow<char>;
+
+// { dg-final { scan-assembler "_ZN7shallowIcEC2Ev" } }