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
48 lines
2.1 KiB
C++
48 lines
2.1 KiB
C++
// RUN: %clang_cc1 -std=c++20 -Wno-unused-value -fsyntax-only -verify %s
|
|
|
|
namespace misplaced_capture_default {
|
|
void Test() {
|
|
int i = 0;
|
|
[&, i, &] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
|
|
[&, i, = ] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
|
|
[=, &i, &] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
|
|
[=, &i, = ] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
|
|
|
|
[i, &] {}; // expected-error {{capture default must be first}}
|
|
[i, = ] {}; // expected-error {{capture default must be first}}
|
|
[i, = x] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
|
|
[=, &i] {}; // ok
|
|
[&, &i] {}; // expected-error {{'&' cannot precede a capture when the capture default is '&'}}
|
|
[&x = i] {}; // ok
|
|
[=, &x = i] {}; // ok
|
|
[x = &i] {}; // ok
|
|
[=, &x = &i] {}; // expected-error {{non-const lvalue reference to type 'int *' cannot bind to a temporary of type 'int *'}}
|
|
[&, this] {}; // expected-error {{'this' cannot be captured in this context}}
|
|
|
|
[i, &, x = 2] {}; // expected-error {{capture default must be first}}
|
|
[i, =, x = 2] {}; // expected-error {{capture default must be first}}
|
|
}
|
|
} // namespace misplaced_capture_default
|
|
|
|
namespace misplaced_capture_default_pack {
|
|
template <typename... Args> void Test(Args... args) {
|
|
[&, args...] {}; // ok
|
|
[args..., &] {}; // expected-error {{capture default must be first}}
|
|
[=, &args...] {}; // ok
|
|
[&, ... xs = &args] {}; // ok
|
|
[&, ... xs = &] {}; // expected-error {{expected expression}}
|
|
[... xs = &] {}; // expected-error {{expected expression}}
|
|
[... xs = &args, = ] {}; // expected-error {{capture default must be first}}
|
|
[... xs = &args, &] {}; // expected-error {{capture default must be first}}
|
|
}
|
|
} // namespace misplaced_capture_default_pack
|
|
|
|
namespace GH163498 {
|
|
struct S {
|
|
template <class T> S(T) {}
|
|
};
|
|
void t() {
|
|
S s{[a(42), &] {}}; // expected-error {{capture default must be first}}
|
|
}
|
|
}
|