]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Add fixed test [PR88848]
authorMarek Polacek <polacek@redhat.com>
Fri, 8 Dec 2023 18:44:10 +0000 (13:44 -0500)
committerMarek Polacek <polacek@redhat.com>
Fri, 8 Dec 2023 18:44:54 +0000 (13:44 -0500)
This one was fixed by r12-7714-g47da5198766256.

PR c++/88848

gcc/testsuite/ChangeLog:

* g++.dg/inherit/multiple2.C: New test.

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

diff --git a/gcc/testsuite/g++.dg/inherit/multiple2.C b/gcc/testsuite/g++.dg/inherit/multiple2.C
new file mode 100644 (file)
index 0000000..dd3d0da
--- /dev/null
@@ -0,0 +1,35 @@
+// PR c++/88848
+// { dg-do compile { target c++17 } }
+
+template<typename>
+struct True { static constexpr bool value{ true }; };
+
+template<int VALUE>
+struct Integer { static constexpr int value{ VALUE }; };
+
+template<int VALUE, typename TYPE>
+struct Foo
+{
+  using Integer_t = Integer<VALUE>;
+
+  static TYPE get_type(Integer_t);
+};
+
+template<typename... ARGS>
+struct Bar : ARGS...
+{
+  using ARGS::get_type...;
+
+  template<int VALUE>
+  using Type_t = decltype(get_type(Integer<VALUE>{}));
+
+  Bar() { static_assert((True< Type_t<ARGS::Integer_t::value> >::value && ...)); }
+
+  static_assert((True< Type_t<ARGS::Integer_t::value> >::value && ...));
+};
+
+int main()
+{
+  Bar<Foo<4, float>, Foo<8, double>> obj;
+  return int{ sizeof(obj) };
+}