| 1 |
// RUN: %clang_cc1 %s -O0 -disable-llvm-passes -triple=x86_64 -std=c++20 -emit-llvm -o - | FileCheck %s |
| 2 |
|
| 3 |
namespace GH161029_regression1 { |
| 4 |
template <class _Fp> auto f(int) { _Fp{}(0); } |
| 5 |
template <class _Fp, int... _Js> void g() { |
| 6 |
(..., f<_Fp>(_Js)); |
| 7 |
} |
| 8 |
enum E { k }; |
| 9 |
template <int, E> struct ElementAt; |
| 10 |
template <E First> struct ElementAt<0, First> { |
| 11 |
static int value; |
| 12 |
}; |
| 13 |
template <typename T, T Item> struct TagSet { |
| 14 |
template <int Index> using Tag = ElementAt<Index, Item>; |
| 15 |
}; |
| 16 |
template <typename TagSet> struct S { |
| 17 |
void U() { (void)TagSet::template Tag<0>::value; } |
| 18 |
}; |
| 19 |
S<TagSet<E, k>> s; |
| 20 |
void h() { |
| 21 |
g<decltype([](auto) -> void { s.U(); }), 0>(); |
| 22 |
} |
| 23 |
// CHECK-DAG: call void @_ZN20GH161029_regression11SINS_6TagSetINS_1EELS2_0EEEE1UEv |
| 24 |
} |
| 25 |
|
| 26 |
namespace GH177807 { |
| 27 |
template<int &G> void foo() { |
| 28 |
[](auto ...A) { |
| 29 |
(((void)A, G), ...) = 1234; |
| 30 |
}(0); |
| 31 |
} |
| 32 |
int i = 0; |
| 33 |
template void foo<i>(); |
| 34 |
// CHECK-DAG: store i32 1234, ptr @_ZN8GH1778071iE, align 4 |
| 35 |
} |