diff mbox series

[committed] Add testcases for already fixed PRs PR88872, PR90019, PR94616, PR95226

Message ID 20210514143458.GT1179226@tucnak
State New
Headers show
Series [committed] Add testcases for already fixed PRs PR88872, PR90019, PR94616, PR95226 | expand

Commit Message

Jakub Jelinek May 14, 2021, 2:34 p.m. UTC
Hi!

While going through [8 Regression] PRs that weren't fixed in 8.5 and
thus will remain broken in 8.x forever I've committed following 4
testcases into the testsuite after testing them on x86_64-linux.

	Jakub
testsuite: Add testcase for already fixed PR [PR88872]

2021-05-14  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/cpp1y/pr88872.C: New test.
testsuite: Add testcase for already fixed PR [PR90019]

2021-05-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/90019
	* g++.dg/cpp0x/sfinae68.C: New test.

diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae68.C b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C
new file mode 100644
index 00000000000..d292b68bff6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae68.C
@@ -0,0 +1,23 @@
+// PR c++/90019
+// { dg-do compile { target c++11 } }
+
+template<bool, typename T = void>
+struct enable_if { };
+template<typename T>
+struct enable_if<true, T> { typedef T type; };
+template<bool C, typename T = void>
+using __enable_if_t = typename enable_if<C, T>::type;
+template<bool C, typename T = void>
+using enable_if_t = typename enable_if<C, T>::type;
+
+template <int I, enable_if_t<I == 0, int>...> void foo() {}
+template <int I, enable_if_t<I != 0, int>...> void foo() {}
+template <int I, int=0, enable_if_t<I == 0, int>...> void bar() {}
+template <int I, int=0, enable_if_t<I != 0, int>...> void bar() {}
+
+void test()
+{
+  bar<0>();
+  bar<0,0>();
+  foo<0>();
+}
testsuite: Add testcase for already fixed PR [PR94616]

2021-05-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/94616
	* g++.dg/cpp0x/pr94616.C: New test.

diff --git a/gcc/testsuite/g++.dg/cpp0x/pr94616.C b/gcc/testsuite/g++.dg/cpp0x/pr94616.C
new file mode 100644
index 00000000000..a8fe700a9db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr94616.C
@@ -0,0 +1,23 @@
+// PR c++/94616
+// { dg-do compile { target c++11 } }
+
+struct Bar {
+  Bar(int n) { if (n > 0) throw 2; }
+  ~Bar() {}
+};
+
+struct Foo {
+  Bar b1 = 0;
+  Bar b2 = 1;
+  Foo() {}
+  ~Foo() {}
+};
+
+int
+main()
+{
+  try {
+    Foo f;
+  } catch(int) {
+  }
+}
testsuite: Add testcase for already fixed PR [PR95226]

2021-05-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/95226
	* g++.dg/cpp1y/pr95226.C: New test.

diff --git a/gcc/testsuite/g++.dg/cpp1y/pr95226.C b/gcc/testsuite/g++.dg/cpp1y/pr95226.C
new file mode 100644
index 00000000000..614c83c8cda
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr95226.C
@@ -0,0 +1,17 @@
+// PR c++/95226
+// { dg-do run { target c++14 } }
+
+#include <vector>
+
+struct T {
+  unsigned a;
+  float b {8.};
+};
+
+int main()
+{
+  T t = {1};
+  std::vector<T> tt = {{1}, {2}};
+  if (t.a != 1 || t.b != 8.0f || tt[0].a != 1 || tt[0].b != 8.0f || tt[1].a != 2 || tt[1].b != 8.0f)
+    __builtin_abort ();
+}
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/cpp1y/pr88872.C b/gcc/testsuite/g++.dg/cpp1y/pr88872.C
new file mode 100644
index 00000000000..3719e395c0e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr88872.C
@@ -0,0 +1,24 @@ 
+// PR c++/88872
+// { dg-do compile { target c++14 } }
+
+struct a {
+  template <typename b> constexpr a(b) : c() {}
+  int c;
+};
+void d();
+template <char...> constexpr a operator"" _n() { return d; }
+struct e;
+struct f {
+  e operator[](int);
+};
+struct g {
+  void h();
+  f i;
+};
+template <typename> struct j {
+  void k() { [](auto) { constexpr auto l = 2_n; }(keywords); }
+  int keywords;
+};
+using m = j<int>;
+class e : public m {};
+void g::h() { i[0].k(); }