Roman Lebedev | 7d27414 | 2018-08-01 21:20:58 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -emit-llvm-only -o - |
Roman Lebedev | 4aaf1dc | 2018-08-01 06:06:16 +0000 | [diff] [blame] | 2 | |
| 3 | // https://bugs.llvm.org/show_bug.cgi?id=38356 |
| 4 | // We only check that we do not crash. |
| 5 | |
Erik Pilkington | 6c7687e | 2019-08-28 22:38:36 +0000 | [diff] [blame] | 6 | // This test can exceed stack usage in some configurations, so unless we can |
| 7 | // properly handle that don't run it. |
| 8 | // REQUIRES: thread_support |
Volodymyr Sapsai | 536a5c4 | 2018-11-06 02:16:28 +0000 | [diff] [blame] | 9 | |
Roman Lebedev | 4aaf1dc | 2018-08-01 06:06:16 +0000 | [diff] [blame] | 10 | template <typename a, a b(unsigned), int c, unsigned...> |
| 11 | struct d : d<a, b, c - 1> {}; |
| 12 | template <typename a, a b(unsigned), unsigned... e> |
| 13 | struct d<a, b, 0, e...> { |
| 14 | a f[0]; |
| 15 | }; |
| 16 | struct g { |
| 17 | static g h(unsigned); |
| 18 | }; |
| 19 | struct i { |
| 20 | void j() const; |
| 21 | // Current maximum depth of recursive template instantiation is 1024, |
| 22 | // thus, this \/ threshold value is used here. BasePathSize in CastExpr might |
| 23 | // not fit it, so we are testing that we do fit it. |
| 24 | // If -ftemplate-depth= is provided, larger values (4096 and up) cause crashes |
| 25 | // elsewhere. |
| 26 | d<g, g::h, (1U << 10U) - 2U> f; |
| 27 | }; |
| 28 | void i::j() const { |
| 29 | const void *k{f.f}; |
| 30 | (void)k; |
| 31 | } |