tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775]
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Warray-bounds-10.C
blob0a18f637e0e510e65916ede189cf426e452f0658
1 // PR c++/94775
2 // { dg-do compile { target c++14 } }
3 // { dg-options "-O2 -Warray-bounds" }
5 template <typename> using a = int;
6 template <bool, typename, typename> using b = int;
7 typedef char d;
8 template <long> using e = int;
9 template <int f, int q> struct h { using i = b<q, a<e<f>>, e<f>>; };
10 template <long f, bool g> using j = typename h<f, g>::i;
11 long ab, k, aj;
12 const d l[]{};
13 class m {
14 public:
15   m(int);
17 class n {
18   void ad() const;
19   template <class ae> void o(long) const {
20     using c __attribute__((aligned(1))) = const ae;
21   }
22   long p;
23   template <class, class>
24   auto s(unsigned long, unsigned long, unsigned long, unsigned long) const;
25   template <bool = false> auto q(unsigned long, unsigned long) const;
27 template <class, class>
28 auto n::s(unsigned long, unsigned long, unsigned long, unsigned long t) const {
29   o<d>(p);
30   return t;
32 template <bool g> auto n::q(unsigned long p1, unsigned long p2) const {
33   using r = j<4, false>;
34   using ai = j<4, g>;
35   return s<ai, r>(ab, k, p1, p2);
37 void n::ad() const {
38   long f(l[aj]); // { dg-warning "outside array bounds" }
39   m(q(8, f));