mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-15 10:26:23 +00:00

packs. Two changes: * Track odr-use via FunctionParmPackExprs to properly handle dependent odr-uses of packs in generic lambdas. * Do not instantiate implicit captures; instead, regenerate them by instantiating the body of the lambda. This is necessary to distinguish between cases where only one element of a pack is captured and cases where the entire pack is captured. This reinstates r362358 (reverted in r362375) with a fix for an uninitialized variable use in UpdateMarkingForLValueToRValue. llvm-svn: 362531
18 lines
555 B
C++
18 lines
555 B
C++
// RUN: %clang_cc1 -std=c++2a -verify %s
|
|
// expected-no-diagnostics
|
|
|
|
template<typename ...T, typename ...Lambda> void check_sizes(Lambda ...L) {
|
|
static_assert(((sizeof(T) == sizeof(Lambda)) && ...));
|
|
}
|
|
|
|
template<typename ...T> void f(T ...v) {
|
|
// Pack expansion of lambdas: each lambda captures only one pack element.
|
|
check_sizes<T...>([=] { (void)&v; } ...);
|
|
|
|
// Pack expansion inside lambda: captures all pack elements.
|
|
auto l = [=] { ((void)&v, ...); };
|
|
static_assert(sizeof(l) >= (sizeof(T) + ...));
|
|
}
|
|
|
|
template void f(int, char, double);
|