]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++/reflection: add fixed test [PR124324]
authorMarek Polacek <polacek@redhat.com>
Tue, 3 Mar 2026 14:40:31 +0000 (09:40 -0500)
committerMarek Polacek <polacek@redhat.com>
Tue, 3 Mar 2026 14:41:06 +0000 (09:41 -0500)
Another test for the recently-fixed PR124324.

PR c++/124324

gcc/testsuite/ChangeLog:

* g++.dg/reflect/substitute6.C: New test.

gcc/testsuite/g++.dg/reflect/substitute6.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/reflect/substitute6.C b/gcc/testsuite/g++.dg/reflect/substitute6.C
new file mode 100644 (file)
index 0000000..8d9665b
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/124324
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+#include <meta>
+
+template<typename>
+void function ();
+
+constexpr auto substituted = substitute (^^function, {^^int});
+static_assert (is_function (substituted));
+constexpr auto t = type_of (substituted);
+[: t :] bar;