From a210d404d08e363af4b2e2a60986c3cb08f8ebc5 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 10 Nov 2020 14:57:19 -0500 Subject: [PATCH] c++: Add 5 unfixed tests. A couple of dg-ice tests. gcc/testsuite/ChangeLog: PR c++/52830 PR c++/88982 PR c++/90799 PR c++/87765 PR c++/89565 * g++.dg/cpp0x/constexpr-52830.C: New test. * g++.dg/cpp0x/vt-88982.C: New test. * g++.dg/cpp1z/class-deduction76.C: New test. * g++.dg/cpp1z/constexpr-lambda26.C: New test. * g++.dg/cpp2a/nontype-class39.C: New test. --- gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C | 37 +++++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/vt-88982.C | 14 +++++++ .../g++.dg/cpp1z/class-deduction76.C | 25 +++++++++++++ .../g++.dg/cpp1z/constexpr-lambda26.C | 13 +++++++ gcc/testsuite/g++.dg/cpp2a/nontype-class39.C | 12 ++++++ 5 files changed, 101 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C create mode 100644 gcc/testsuite/g++.dg/cpp0x/vt-88982.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction76.C create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C create mode 100644 gcc/testsuite/g++.dg/cpp2a/nontype-class39.C diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C new file mode 100644 index 00000000000..2c9d2f9b329 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-52830.C @@ -0,0 +1,37 @@ +// PR c++/52830 +// { dg-do compile { target c++11 } } +// { dg-ice "comptypes" } + +template struct eif { typedef void type; }; +template<> struct eif {}; + +template struct same +{ + static constexpr bool value = false; +}; +template +struct same +{ + static constexpr bool value = true; +}; + + +struct foo { + template + void func(T && a, + typename eif::value>::type * = 0); +}; + +template +void +foo:: +func(T && a, + typename eif::value>::type * ) +{ +} + +void do_stuff() +{ + foo f; + f.func(12); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-88982.C b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C new file mode 100644 index 00000000000..cb9530dcee1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/vt-88982.C @@ -0,0 +1,14 @@ +// PR c++/88982 +// { dg-do compile { target c++11 } } +// { dg-ice "tsubst_pack_expansion" } + +template struct A { + template class ...Cs, Cs ...Vs> struct B { + B() { + } + }; +}; + +template using Int = int; +template using Char = char; +A::B b; diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction76.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction76.C new file mode 100644 index 00000000000..23bb6e8fa9a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction76.C @@ -0,0 +1,25 @@ +// PR c++/90799 +// { dg-do compile { target c++17 } } +// { dg-ice "unify" } + +template +void foo() noexcept(T::value); + +struct S { + static constexpr const bool value = true; + + template + void bar() noexcept(T::value); +}; + +template +constexpr bool is_noexcept_function(void(Args...) noexcept(is_noexcept)) noexcept { + return is_noexcept; +} + +template +constexpr bool is_noexcept_member_function(void(S::*)(Args...) noexcept(is_noexcept)) noexcept { + return is_noexcept; +} + +static_assert(is_noexcept_function(foo)); diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C new file mode 100644 index 00000000000..d6c8bae525f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C @@ -0,0 +1,13 @@ +// PR c++/87765 +// { dg-do compile { target c++17 } } +// { dg-ice "cxx_eval_constant_expression" } + +template +using foo = int; + +struct A { + constexpr int bar() const { return 42; } +}; + +void baz(A a) { + [=](auto c) { return foo { }; }; } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C new file mode 100644 index 00000000000..f5f79a71ec2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class39.C @@ -0,0 +1,12 @@ +// PR c++/89565 +// { dg-do compile { target c++20 } } +// { dg-ice "resolve_args" } + +template +struct N{}; + +template +struct S {}; + +template +using NS = S; -- 2.30.2