aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/conversion/packed2.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-92015.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nontype5.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-incr2.C66
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nontype1.C42
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/var-templ63.C5
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp50.C51
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/eval-order5.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/attr-likely6.C14
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C12
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr90767-1.C15
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr90767-2.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/is_final.C14
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr92504.C29
-rw-r--r--gcc/testsuite/g++.dg/init/array54.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/pr91572_0.C12
-rw-r--r--gcc/testsuite/g++.dg/opt/pr91351.C38
-rw-r--r--gcc/testsuite/g++.dg/opt/pr92007.C32
-rw-r--r--gcc/testsuite/g++.dg/other/pr92201.C7
-rw-r--r--gcc/testsuite/g++.dg/pr92022.C13
-rw-r--r--gcc/testsuite/g++.dg/torture/pr91155.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr91606.C109
-rw-r--r--gcc/testsuite/g++.dg/torture/pr92384.C38
26 files changed, 674 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/conversion/packed2.C b/gcc/testsuite/g++.dg/conversion/packed2.C
new file mode 100644
index 00000000000..7df74dc110b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/packed2.C
@@ -0,0 +1,15 @@
+// PR c++/91925
+// { dg-do compile { target c++11 } }
+// { dg-options "-fpack-struct" }
+
+struct A {};
+int foo (A);
+struct B {
+ A a;
+ decltype (foo (a)) p;
+};
+template <typename T> T bar (T);
+class C {
+ A a;
+ decltype (bar (a)) p;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-92015.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-92015.C
new file mode 100644
index 00000000000..60f288ee993
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-92015.C
@@ -0,0 +1,7 @@
+// PR c++/92015
+// { dg-do compile { target c++11 } }
+
+struct S1 { char c[6] {'h', 'e', 'l', 'l', 'o', 0}; };
+struct S2 { char c[6] = "hello"; };
+static_assert (S1{}.c[0] == 'h', "");
+static_assert (S2{}.c[0] == 'h', "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C
new file mode 100644
index 00000000000..cf3f95f0565
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-odr1.C
@@ -0,0 +1,19 @@
+// PR c++/92062 - ODR-use ignored for static member of class template.
+// { dg-do run { target c++11 } }
+
+template<int> struct A {
+ static const bool x;
+ static_assert(&x, ""); // odr-uses A<...>::x
+};
+
+int g;
+
+template<int I>
+const bool A<I>::x = (g = 42, false);
+
+void f(A<0>) {} // A<0> must be complete, so is instantiated
+int main()
+{
+ if (g != 42)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C
new file mode 100644
index 00000000000..0927488e569
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-odr2.C
@@ -0,0 +1,19 @@
+// PR c++/92062 - ODR-use ignored for static member of class template.
+// { dg-do run { target c++11 } }
+
+template<int> struct A {
+ static const bool x;
+ enum { force_instantiation =! &x}; // odr-uses A<...>::x
+};
+
+int g;
+
+template<int I>
+const bool A<I>::x = (g = 42, false);
+
+void f(A<0>) {} // A<0> must be complete, so is instantiated
+int main()
+{
+ if (g != 42)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype5.C b/gcc/testsuite/g++.dg/cpp0x/nontype5.C
new file mode 100644
index 00000000000..c31134581aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nontype5.C
@@ -0,0 +1,17 @@
+// PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+constexpr bool is_integral_(...) {
+ return false;
+}
+template<typename T, T = 1>
+constexpr bool is_integral_(long) {
+ return true;
+}
+
+static_assert(is_integral_<int>(42), "");
+static_assert(!is_integral_<void>(42), "");
+
+struct S {};
+static_assert(!is_integral_<S>(42), "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C b/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C
new file mode 100644
index 00000000000..6fcdbbaa6a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/overload-conv-4.C
@@ -0,0 +1,23 @@
+// PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wconversion" }
+
+struct B;
+
+struct A {
+ operator B();
+};
+
+struct B {
+ B(A const &rs);
+ B(B const &rs);
+};
+
+B
+f (A x)
+{
+ // C++14: we call B::B(A const &)
+ // C++17: we call A::operator B()
+ return B(x); // { dg-warning "choosing .A::operator B\\(\\). over .B::B\\(const A&\\)" "" { target c++17 } }
+ // { dg-warning "for conversion from .A. to .B." "" { target c++17 } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-incr2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-incr2.C
new file mode 100644
index 00000000000..0d22851e4b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-incr2.C
@@ -0,0 +1,66 @@
+// PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
+// { dg-do compile { target c++14 } }
+
+#define SA(X) static_assert((X),#X)
+
+template <class T>
+constexpr T fn1(T t)
+{
+ return ++t;
+}
+
+constexpr float fn2(float t)
+{
+ return ++t;
+}
+
+template <class T>
+constexpr T fn3(T t)
+{
+ return --t;
+}
+
+constexpr float fn4(float t)
+{
+ return --t;
+}
+
+template <class T>
+constexpr T fn5(T t)
+{
+ return t++;
+}
+
+constexpr float fn6(float t)
+{
+ return t++;
+}
+
+template <class T>
+constexpr T fn7(T t)
+{
+ return t--;
+}
+
+constexpr float fn8(float t)
+{
+ return t--;
+}
+
+constexpr double r1 = fn1(2.0f);
+SA(r1 == 3);
+constexpr double r2 = fn2(2.0f);
+SA(r2 == 3);
+constexpr double r3 = fn3(2.0f);
+SA(r3 == 1);
+constexpr double r4 = fn4(2.0f);
+SA(r4 == 1);
+
+constexpr double r5 = fn5(2.0f);
+SA(r5 == 2);
+constexpr double r6 = fn6(2.0f);
+SA(r6 == 2);
+constexpr double r7 = fn7(2.0f);
+SA(r7 == 2);
+constexpr double r8 = fn8(2.0f);
+SA(r8 == 2);
diff --git a/gcc/testsuite/g++.dg/cpp1y/nontype1.C b/gcc/testsuite/g++.dg/cpp1y/nontype1.C
new file mode 100644
index 00000000000..a37e996a3ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nontype1.C
@@ -0,0 +1,42 @@
+// PR c++/91129 - wrong error with binary op in template argument.
+// { dg-do compile { target c++14 } }
+
+template<class T, T v>
+struct C
+{
+ constexpr operator T() const { return v; }
+ constexpr auto operator()() const { return v; }
+};
+
+template<class T, int N>
+struct A
+{
+};
+
+template<int N>
+void foo ()
+{
+ A<int, C<int, 6>{}> a0;
+ A<int, !C<int, 6>{}> a1;
+ A<int, N / C<int, 6>{}> a2;
+ A<int, N % C<int, 6>{}> a3;
+ A<int, N * C<int, 6>{}> a4;
+ A<int, N ^ C<int, 6>{}> a5;
+ A<int, N | C<int, 6>{}> a6;
+ A<int, N & C<int, 6>{}> a7;
+ A<int, N + C<int, 6>{}> a8;
+ A<int, N - C<int, 6>{}> a9;
+ A<int, -C<int, 6>{}> a10;
+ A<int, (N >> C<int, 6>{})> a11;
+ A<int, N << C<int, 6>{}> a12;
+ A<int, ~C<int, 6>{}> a13;
+ A<int, N || C<int, 6>{}> a14;
+ A<int, N && C<int, 6>{}> a15;
+ A<int, N == C<int, 6>{}> a16;
+ A<int, N != C<int, 6>{}> a17;
+}
+
+int main()
+{
+ foo<10>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ63.C b/gcc/testsuite/g++.dg/cpp1y/var-templ63.C
new file mode 100644
index 00000000000..a65f53b2963
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ63.C
@@ -0,0 +1,5 @@
+// PR c++/91740 - ICE with constexpr call and ?: in ARRAY_REF.
+// { dg-do compile { target c++14 } }
+
+constexpr bool f(const char*) { return true; }
+template<typename T> const char c = "FOO"[f("BAR") ? 1 : 0];
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp50.C b/gcc/testsuite/g++.dg/cpp1z/decomp50.C
new file mode 100644
index 00000000000..5400a826948
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp50.C
@@ -0,0 +1,51 @@
+// PR c++/92106 - ICE with structured bindings and -Wreturn-local-addr.
+// { dg-do compile { target c++17 } }
+
+template <typename> struct B;
+template <typename _Tp> struct B<_Tp *> { typedef _Tp& reference; };
+struct C {
+ template <typename _Up> using rebind = _Up *;
+};
+template <typename _Iterator, typename> class D {
+public:
+ typename B<_Iterator>::reference operator*();
+ void operator++();
+};
+
+template <typename _Iterator, typename _Container>
+bool operator!=(D<_Iterator, _Container>, D<_Iterator, _Container>);
+template <typename _Tp> class F {
+public:
+ typedef _Tp value_type;
+};
+
+template <typename _Alloc> struct G {
+ template <typename _Tp> struct H { using type = C::rebind<_Tp>; };
+ using const_pointer = typename H<typename _Alloc::value_type>::type;
+};
+template <typename _Tp, typename _Alloc = F<_Tp>> class I {
+ typedef D<typename G<_Alloc>::const_pointer, int> const_iterator;
+
+public:
+ const_iterator begin();
+ const_iterator end();
+};
+
+struct A {
+ struct J {
+ int name;
+ int value;
+ };
+ I<J> members;
+ template <typename Key> const int *find(Key) {
+ for (const auto &[name, value] : members)
+ // See <https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01107.html>
+ // for why we don't warn here.
+ return &value; // { dg-bogus "address of local variable" }
+ return nullptr;
+ }
+};
+int main() {
+ A a;
+ a.find("");
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/eval-order5.C b/gcc/testsuite/g++.dg/cpp1z/eval-order5.C
new file mode 100644
index 00000000000..a8f06ed421a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/eval-order5.C
@@ -0,0 +1,31 @@
+// PR c++/91974
+// { dg-do run }
+// { dg-options "-fstrong-eval-order" }
+
+extern "C" void abort ();
+
+bool ok = false;
+
+void
+foo (int x)
+{
+ if (x != 0)
+ abort ();
+ ok = true;
+}
+
+void
+bar (int)
+{
+ abort ();
+}
+
+int
+main ()
+{
+ typedef void (*T) (int);
+ T fn = foo;
+ fn ((fn = bar, 0));
+ if (fn != bar || !ok)
+ abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/attr-likely6.C b/gcc/testsuite/g++.dg/cpp2a/attr-likely6.C
new file mode 100644
index 00000000000..a04021e5037
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/attr-likely6.C
@@ -0,0 +1,14 @@
+// PR c++/92343
+// { dg-do compile { target c++14 } }
+
+constexpr bool
+foo (bool x)
+{
+ if (x)
+ [[unlikely]] return true;
+ else
+ [[likely]] return false;
+}
+
+static_assert (foo (true), "");
+static_assert (!foo (false), "");
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C
new file mode 100644
index 00000000000..6cd99cc9bb8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr91887.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-options "-g -fdebug-types-section" }
+class A {
+public:
+ A();
+ template <typename U> A(U);
+};
+template <class> struct B { typedef A type; };
+template <class R, typename... Args>
+int Bind(R(Args...), typename B<Args>::type...) { return 0; }
+void KeepBufferRefs(A, A) { A a, b(Bind(KeepBufferRefs, a, b)); }
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr90767-1.C b/gcc/testsuite/g++.dg/diagnostic/pr90767-1.C
new file mode 100644
index 00000000000..7d1cd3db398
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr90767-1.C
@@ -0,0 +1,15 @@
+// PR c++/90767
+// { dg-do compile }
+
+struct X {
+ int n;
+ void foo (); // { dg-message "initializing argument 'this'" }
+
+ template<typename T>
+ operator T () const
+ {
+ if (n == 0)
+ foo (); // { dg-error "cannot convert 'const X\\*' to 'X\\*'" }
+ return n;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr90767-2.C b/gcc/testsuite/g++.dg/diagnostic/pr90767-2.C
new file mode 100644
index 00000000000..550762b2db9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr90767-2.C
@@ -0,0 +1,15 @@
+// PR c++/90767
+// { dg-do compile }
+
+struct A {
+ struct B { B (int) {} };
+
+ template <typename T>
+ void foo ()
+ {
+ int x = 0;
+ bar (x); // { dg-error "cannot convert 'int' to 'A::B&'" }
+ }
+
+ void bar (B &arg) {} // { dg-message "initializing argument 1" }
+};
diff --git a/gcc/testsuite/g++.dg/ext/is_final.C b/gcc/testsuite/g++.dg/ext/is_final.C
index b3875ad04ae..20e5d629ff5 100644
--- a/gcc/testsuite/g++.dg/ext/is_final.C
+++ b/gcc/testsuite/g++.dg/ext/is_final.C
@@ -43,3 +43,17 @@ static_assert( __is_final (Ff<int>), "Ff<int> is final" );
static_assert( __is_final (Ff<A>), "Ff<A> is final" );
static_assert( __is_final (Ff<Af>), "Ff<Af> is final" );
+// PR 85254
+
+template <class T> struct final_trait_wrap{ typedef T type; };
+
+template <class T> struct my_is_final
+{
+ static const bool value = __is_final(typename final_trait_wrap<T>::type);
+};
+
+struct final1 final {};
+template <typename T> struct final2 final {};
+
+static_assert( my_is_final<final1>::value, "final1 is final" );
+static_assert( my_is_final<final2<int>>::value, "final2<int> is final" );
diff --git a/gcc/testsuite/g++.dg/gomp/pr92504.C b/gcc/testsuite/g++.dg/gomp/pr92504.C
new file mode 100644
index 00000000000..8df67621532
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr92504.C
@@ -0,0 +1,29 @@
+// PR c++/92504
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-O2" }
+
+namespace std {
+ typedef __SIZE_TYPE__ size_t;
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+}
+
+struct A {
+ A ();
+ A (const A &);
+ A & operator++ ();
+ bool operator != (const A &) const;
+ std::ptrdiff_t operator - (const A &);
+ A & operator += (std::size_t);
+ int a;
+ A & begin ();
+ A & end (); // { dg-message "declared here" }
+};
+
+void
+bar ()
+{
+ A a;
+ #pragma omp for
+ for (auto b = a; b != a.end; ++b) // { dg-error "invalid use of non-static member function" }
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/init/array54.C b/gcc/testsuite/g++.dg/init/array54.C
new file mode 100644
index 00000000000..f6be350ba72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/array54.C
@@ -0,0 +1,13 @@
+// PR c++/90947
+// { dg-do run { target c++11 } }
+
+#include <atomic>
+
+static std::atomic<int> a[1] { {1} };
+
+int
+main ()
+{
+ if (a[0].load () != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr91572_0.C b/gcc/testsuite/g++.dg/lto/pr91572_0.C
new file mode 100644
index 00000000000..95a7e9fabf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr91572_0.C
@@ -0,0 +1,12 @@
+// PR lto/91572
+// { dg-lto-do link }
+// { dg-lto-options { { -O -fPIC -flto } } }
+// { dg-require-effective-target shared }
+// { dg-require-effective-target fpic }
+// { dg-extra-ld-options "-shared" }
+
+void foo (char);
+namespace N {
+ class A { A (); };
+ A::A () { asm ("" : : "g" (0)); }
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr91351.C b/gcc/testsuite/g++.dg/opt/pr91351.C
new file mode 100644
index 00000000000..f793a2f1b11
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr91351.C
@@ -0,0 +1,38 @@
+// PR tree-optimization/91351
+// { dg-do run }
+// { dg-options "-O2 -fstrict-enums" }
+
+enum E { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12,
+ e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25 };
+
+__attribute__((noipa)) void
+foo ()
+{
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+bar ()
+{
+}
+
+__attribute__((noipa)) void
+baz (E e)
+{
+ switch (e)
+ {
+ case e11:
+ case e12:
+ case e13: foo (); break;
+ case e24: break;
+ case e14:
+ case e15: break;
+ default: bar (); break;
+ }
+}
+
+int
+main ()
+{
+ baz (e3);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr92007.C b/gcc/testsuite/g++.dg/opt/pr92007.C
new file mode 100644
index 00000000000..9434cc929dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr92007.C
@@ -0,0 +1,32 @@
+// PR rtl-optimization/92007
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-dominator-opts -fno-tree-forwprop --param max-cse-insns=0 -Wno-return-type -std=gnu++98 -freorder-blocks-and-partition" }
+
+void
+sb (int *);
+
+class d4 {
+public:
+ ~d4();
+ void gb ();
+ int op () { return no; }
+ int wl () { return tf; }
+ bool ee () try { gb (); } catch (...) { return false; }
+ bool b1 () { return (tf == no) ? false : ee (); }
+
+private:
+ int no, tf;
+};
+
+void
+hs (int *v9)
+{
+ d4 p6;
+
+ p6.gb ();
+ if (p6.op () > p6.wl ())
+ {
+ p6.b1 ();
+ sb (v9);
+ }
+}
diff --git a/gcc/testsuite/g++.dg/other/pr92201.C b/gcc/testsuite/g++.dg/other/pr92201.C
new file mode 100644
index 00000000000..15ba1a12525
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr92201.C
@@ -0,0 +1,7 @@
+// PR c++/92201
+
+int
+foo (void (*p) ())
+{
+ return (*reinterpret_cast<int (*)()> (p)) ();
+}
diff --git a/gcc/testsuite/g++.dg/pr92022.C b/gcc/testsuite/g++.dg/pr92022.C
new file mode 100644
index 00000000000..066d984ffc5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr92022.C
@@ -0,0 +1,13 @@
+// { dg-do compile { target alpha*-*-* } }
+// { dg-options "-O1 -g -fno-var-tracking -mcpu=ev4 -mieee" }
+
+struct a {
+ a(long);
+};
+long b;
+void c() {
+ a d(1);
+ double e = b;
+ for (; b;)
+ d = e;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr91155.C b/gcc/testsuite/g++.dg/torture/pr91155.C
new file mode 100644
index 00000000000..04e4f7ab41b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr91155.C
@@ -0,0 +1,18 @@
+/* PR c++/91155. */
+
+template< char C > struct dummy {};
+
+template< typename T > const char *test()
+{
+ __builtin_printf ("test: %s\n", __PRETTY_FUNCTION__);
+ return __PRETTY_FUNCTION__;
+}
+
+int main()
+{
+ if (__builtin_strcmp ("const char* test() [with T = dummy<\'\\000\'>]", test< dummy< '\0' > > ()) != 0)
+ {};// __builtin_abort ();
+ if (__builtin_strcmp ("const char* test() [with T = dummy<\'\\\'\'>]", test< dummy< '\'' > > ()) != 0)
+ {};// __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr91606.C b/gcc/testsuite/g++.dg/torture/pr91606.C
new file mode 100644
index 00000000000..37a05a5e3a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr91606.C
@@ -0,0 +1,109 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fstrict-aliasing" } */
+
+#include <cstdlib>
+#include <array>
+#include <type_traits>
+
+template <typename T1, typename T2>
+struct variant
+{
+ constexpr variant(T1 arg)
+ : f1(arg),
+ index(0)
+ {}
+
+ constexpr variant(T2 arg)
+ : f2(arg),
+ index(1)
+ {}
+
+ union
+ {
+ T1 f1;
+ T2 f2;
+ };
+ std::size_t index = 0;
+};
+
+template <typename T1, typename T2>
+constexpr const T1* get_if(const variant<T1, T2>* v)
+{
+ if (v->index != 0)
+ {
+ return nullptr;
+ }
+ return &v->f1;
+}
+
+template <typename T2, typename T1>
+constexpr const T2* get_if(const variant<T1, T2>* v)
+{
+ if (v->index != 1)
+ {
+ return nullptr;
+ }
+ return &v->f2;
+}
+
+template <typename T, size_t N>
+struct my_array
+{
+ constexpr const T* begin() const
+ {
+ return data;
+ }
+
+ constexpr const T* end() const
+ {
+ return data + N;
+ }
+
+ T data[N];
+};
+
+template <typename ...Ts>
+constexpr auto get_array_of_variants(Ts ...ptrs)
+{
+ return std::array<variant<std::decay_t<Ts>...>, sizeof...(Ts)>{ ptrs... };
+}
+
+template <typename T>
+constexpr auto get_member_functions();
+
+template <typename Member, typename Class>
+constexpr int getFuncId(Member (Class::*memFuncPtr))
+{
+ int idx = 0u;
+ for (auto &anyFunc : get_member_functions<Class>())
+ {
+ if (auto *specificFunc = get_if<Member (Class::*)>(&anyFunc))
+ {
+ if (*specificFunc == memFuncPtr)
+ {
+ return idx;
+ }
+ }
+ ++idx;
+ }
+ std::abort();
+}
+
+struct MyStruct
+{
+ void fun1(int /*a*/) {}
+
+ int fun2(char /*b*/, short /*c*/, bool /*d*/) { return 0; }
+
+};
+
+template <>
+constexpr auto get_member_functions<MyStruct>()
+{
+ return get_array_of_variants(&MyStruct::fun1, &MyStruct::fun2);
+}
+
+int main()
+{
+ return getFuncId(&MyStruct::fun1);
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr92384.C b/gcc/testsuite/g++.dg/torture/pr92384.C
new file mode 100644
index 00000000000..049a45a0154
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr92384.C
@@ -0,0 +1,38 @@
+// PR c++/92384
+// { dg-do run }
+
+struct S {};
+struct T : public S { S a, b, c, d, e, f, g, h, i, j, k, l, m; };
+struct U { long long a, b, c; };
+
+U
+foo (S, S, S, T, T, T, U g)
+{
+ return g;
+}
+
+__attribute__((noipa)) bool
+bar (S a, S b, S c, T d, T e, T f, U g, void **h)
+{
+ h[0] = (void *) &a;
+ h[1] = (void *) &b;
+ h[2] = (void *) &c;
+ h[3] = (void *) &d;
+ h[4] = (void *) &e;
+ h[5] = (void *) &f;
+ h[6] = (void *) &g;
+ asm volatile ("" : : "r" (h) : "memory");
+ return (h[0] != h[1] && h[1] != h[2] && h[2] != h[3]
+ && h[3] != h[4] && h[4] != h[5] && h[5] != h[6]);
+}
+
+int
+main ()
+{
+ S a;
+ T b;
+ U c = { 1, 2, 3 };
+ void *d[7];
+ if (!bar (a, a, a, b, b, b, c, d))
+ __builtin_abort ();
+}