| 1 |
// PR c++/94775 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-options "-O2 -Warray-bounds" } |
| 4 |
|
| 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); |
| 16 |
}; |
| 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; |
| 26 |
}; |
| 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; |
| 31 |
} |
| 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); |
| 36 |
} |
| 37 |
void n::ad() const { |
| 38 |
long f(l[aj]); // { dg-warning "outside array bounds" } |
| 39 |
m(q(8, f)); |
| 40 |
} |