Roman Lebedev | 4aaf1dc | 2018-08-01 06:06:16 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -emit-llvm -o - |
| 2 | |
| 3 | // https://bugs.llvm.org/show_bug.cgi?id=38356 |
| 4 | // We only check that we do not crash. |
| 5 | |
| 6 | template <typename a, a b(unsigned), int c, unsigned...> |
| 7 | struct d : d<a, b, c - 1> {}; |
| 8 | template <typename a, a b(unsigned), unsigned... e> |
| 9 | struct d<a, b, 0, e...> { |
| 10 | a f[0]; |
| 11 | }; |
| 12 | struct g { |
| 13 | static g h(unsigned); |
| 14 | }; |
| 15 | struct i { |
| 16 | void j() const; |
| 17 | // Current maximum depth of recursive template instantiation is 1024, |
| 18 | // thus, this \/ threshold value is used here. BasePathSize in CastExpr might |
| 19 | // not fit it, so we are testing that we do fit it. |
| 20 | // If -ftemplate-depth= is provided, larger values (4096 and up) cause crashes |
| 21 | // elsewhere. |
| 22 | d<g, g::h, (1U << 10U) - 2U> f; |
| 23 | }; |
| 24 | void i::j() const { |
| 25 | const void *k{f.f}; |
| 26 | (void)k; |
| 27 | } |