[pushed] c++: Add fixed test [PR88848]
Checks
Commit Message
Tested x86_64-pc-linux-gnu, applying to trunk.
-- >8 --
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 | 35 ++++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/inherit/multiple2.C
base-commit: 0c018a74eb1affe2a1fa385cdddaa93979683420
new file mode 100644
@@ -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) };
+}