blob: 187f52797cd7b03faf505f98c4a8864b1d972382 [file] [log] [blame]
Roman Lebedev7d274142018-08-01 21:20:58 +00001// RUN: %clang_cc1 %s -emit-llvm-only -o -
Roman Lebedev4aaf1dc2018-08-01 06:06:16 +00002
3// https://bugs.llvm.org/show_bug.cgi?id=38356
4// We only check that we do not crash.
5
6template <typename a, a b(unsigned), int c, unsigned...>
7struct d : d<a, b, c - 1> {};
8template <typename a, a b(unsigned), unsigned... e>
9struct d<a, b, 0, e...> {
10 a f[0];
11};
12struct g {
13 static g h(unsigned);
14};
15struct 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};
24void i::j() const {
25 const void *k{f.f};
26 (void)k;
27}