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
55 lines
2.1 KiB
C++
55 lines
2.1 KiB
C++
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -triple i386-windows
|
|
|
|
void defargs() {
|
|
auto l1 = [](int i, int j = 17, int k = 18) { return i + j + k; };
|
|
int i1 = l1(1);
|
|
int i2 = l1(1, 2);
|
|
int i3 = l1(1, 2, 3);
|
|
}
|
|
|
|
|
|
void defargs_errors() {
|
|
auto l1 = [](int i,
|
|
int j = 17,
|
|
int k) { }; // expected-error{{missing default argument on parameter 'k'}}
|
|
|
|
auto l2 = [](int i, int j = i) {}; // expected-error{{default argument references parameter 'i'}}
|
|
|
|
int foo;
|
|
auto l3 = [](int i = foo) {}; // expected-error{{default argument references local variable 'foo' of enclosing function}}
|
|
}
|
|
|
|
struct NonPOD {
|
|
NonPOD();
|
|
NonPOD(const NonPOD&);
|
|
~NonPOD();
|
|
};
|
|
|
|
struct NoDefaultCtor {
|
|
NoDefaultCtor(const NoDefaultCtor&); // expected-note{{candidate constructor}} \
|
|
// expected-note{{candidate constructor not viable: requires 1 argument, but 0 were provided}}
|
|
~NoDefaultCtor();
|
|
};
|
|
|
|
template<typename T>
|
|
void defargs_in_template_unused(T t) {
|
|
auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \
|
|
// expected-note {{in instantiation of default function argument expression for 'operator()<NoDefaultCtor>' required here}}
|
|
l1(t);
|
|
}
|
|
|
|
template void defargs_in_template_unused(NonPOD);
|
|
template void defargs_in_template_unused(NoDefaultCtor); // expected-note{{in instantiation of function template specialization 'defargs_in_template_unused<NoDefaultCtor>' requested here}}
|
|
|
|
template<typename T>
|
|
void defargs_in_template_used() {
|
|
auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \
|
|
// expected-note {{in instantiation of default function argument expression for 'operator()<NoDefaultCtor>' required here}}
|
|
l1();
|
|
}
|
|
|
|
template void defargs_in_template_used<NonPOD>();
|
|
template void defargs_in_template_used<NoDefaultCtor>(); // expected-note{{in instantiation of function template specialization}}
|
|
|