Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/lambda-expressions-gh56071.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

52 lines
1.3 KiB
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unused-value -std=c++17
// expected-no-diagnostics
namespace test1 {
template <int num> int return_num() { return num; }
template <typename lambda> struct lambda_wrapper {
lambda &outer_lambda;
lambda_wrapper(lambda& outer_lambda) : outer_lambda(outer_lambda) {}
template <typename T> auto operator+(T t) { outer_lambda(t); return 1; }
};
template <int... nums, typename lambda>
void bw(lambda& outer_lambda) {
(lambda_wrapper(outer_lambda) + ... + return_num<nums>());
}
template <typename lambda> auto check_return_type(lambda inner_lambda) {
using inner_lambda_return_type = decltype(inner_lambda(5));
}
void cs() {
auto outer_lambda = [](auto param) {
auto inner_lambda = [](auto o) -> decltype(param) {};
check_return_type(inner_lambda);
};
bw<1,2>(outer_lambda);
}
} // namespace test1
namespace test2 {
template <typename lambda>
auto run_lambda_with_zero(lambda l) {
l(0);
}
template <typename ... Ts, typename lambda>
void run_lambda_once_per_type(lambda l) {
((Ts{}, run_lambda_with_zero(l)), ...);
}
template <typename> void inner_function() {
char c;
[](auto param) -> decltype(c) { return param; }(0);
}
void run() {
auto x = [](auto) -> void { inner_function<int>(); };
run_lambda_once_per_type<int>(x);
}
} // namespace test2