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
88 lines
2.8 KiB
C++
88 lines
2.8 KiB
C++
// RUN: %clang_cc1 -std=c++1z %s -verify
|
|
|
|
namespace std {
|
|
template<typename> struct tuple_size;
|
|
template<int, typename> struct tuple_element;
|
|
}
|
|
|
|
struct Get {
|
|
template<int> int get() { return 0; }
|
|
operator bool() { return true; }
|
|
};
|
|
|
|
namespace std {
|
|
template<> struct tuple_size<Get> { static constexpr int value = 1; };
|
|
template<> struct tuple_element<0, Get> { using type = int; };
|
|
}
|
|
|
|
struct Na {
|
|
bool flag;
|
|
float data;
|
|
};
|
|
|
|
struct Rst {
|
|
bool flag;
|
|
float data;
|
|
explicit operator bool() const {
|
|
return flag;
|
|
}
|
|
};
|
|
|
|
Rst f();
|
|
Na g();
|
|
|
|
namespace CondInIf {
|
|
int h() {
|
|
if (auto [ok, d] = f()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
;
|
|
if (auto [ok, d] = g()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}}
|
|
;
|
|
if (auto [value] = Get()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
return value;
|
|
}
|
|
} // namespace CondInIf
|
|
|
|
namespace CondInWhile {
|
|
int h() {
|
|
while (auto [ok, d] = f()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
;
|
|
while (auto [ok, d] = g()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}}
|
|
;
|
|
while (auto [value] = Get()) // expected-warning{{structured binding declaration in a condition is a C++2c extension}}
|
|
return value;
|
|
}
|
|
} // namespace CondInWhile
|
|
|
|
namespace CondInFor {
|
|
int h() {
|
|
for (; auto [ok, d] = f();) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
;
|
|
for (; auto [ok, d] = g();) // expected-warning {{structured binding declaration in a condition is a C++2c extension}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}}
|
|
;
|
|
for (; auto [value] = Get();) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
return value;
|
|
}
|
|
} // namespace CondInFor
|
|
|
|
struct IntegerLike {
|
|
bool flag;
|
|
float data;
|
|
operator int() const {
|
|
return int(data);
|
|
}
|
|
};
|
|
|
|
namespace CondInSwitch {
|
|
int h(IntegerLike x) {
|
|
switch (auto [ok, d] = x) // expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
;
|
|
switch (auto [ok, d] = g()) // expected-warning {{structured binding declaration in a condition is a C++2c extension}} expected-error {{statement requires expression of integer type ('Na' invalid)}}
|
|
;
|
|
switch (auto [value] = Get()) {// expected-warning {{structured binding declaration in a condition is a C++2c extension}}
|
|
// expected-warning@-1{{switch condition has boolean value}}
|
|
case 1:
|
|
return value;
|
|
}
|
|
}
|
|
} // namespace CondInSwitch
|