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
63 lines
2.3 KiB
C++
63 lines
2.3 KiB
C++
// RUN: %clang_cc1 -std=c++17 -verify=cxx17 -Wc++20-compat %s
|
|
// RUN: %clang_cc1 -std=c++20 -verify=cxx20 -Wc++17-compat %s
|
|
|
|
namespace disambig {
|
|
|
|
// Cases that are valid in C++17 and before, ill-formed in C++20, and that we
|
|
// should not treat as explicit(bool) as an extension.
|
|
struct A { // cxx20-note +{{}}
|
|
constexpr A() {}
|
|
constexpr operator bool() { return true; }
|
|
|
|
constexpr explicit (A)(int); // #1
|
|
// cxx17-warning@#1 {{will be parsed as explicit(bool)}}
|
|
// cxx20-error@#1 +{{}} cxx20-note@#1 +{{}}
|
|
// cxx20-warning@#1 {{incompatible with C++ standards before C++20}}
|
|
|
|
// This is ill-formed (via a DR change), and shouldn't be recognized as a
|
|
// constructor (the function declarator cannot be parenthesized in a
|
|
// constructor declaration). But accepting it as an extension seems
|
|
// reasonable.
|
|
// FIXME: Produce an ExtWarn for this.
|
|
constexpr explicit (A(float)); // #1b
|
|
// cxx17-warning@#1b {{will be parsed as explicit(bool)}}
|
|
// cxx20-error@#1b +{{}}
|
|
// cxx20-warning@#1b {{incompatible with C++ standards before C++20}}
|
|
|
|
explicit (operator int)(); // #2
|
|
// cxx17-warning@#2 {{will be parsed as explicit(bool)}}
|
|
// cxx20-error@#2 +{{}}
|
|
// cxx20-warning@#2 {{incompatible with C++ standards before C++20}}
|
|
|
|
explicit (A::operator float)(); // #2b
|
|
// cxx17-warning@#2b {{will be parsed as explicit(bool)}}
|
|
// cxx17-error@#2b {{extra qualification on member}}
|
|
// cxx20-error@#2b +{{}}
|
|
// cxx20-warning@#2b {{incompatible with C++ standards before C++20}}
|
|
};
|
|
|
|
constexpr bool operator+(A) { return true; }
|
|
|
|
constexpr bool C = false;
|
|
|
|
// Cases that should (ideally) be disambiguated as explicit(bool) in earlier
|
|
// language modes as an extension.
|
|
struct B {
|
|
// Looks like a constructor, but not the constructor of B.
|
|
explicit (A()) B(); // #3
|
|
// cxx17-warning@#3 {{C++20 extension}}
|
|
// cxx20-warning@#3 {{incompatible with C++ standards before C++20}}
|
|
|
|
// Looks like a 'constructor' of C. Actually a constructor of B.
|
|
explicit (C)(B)(A); // #4
|
|
// cxx17-warning@#4 {{C++20 extension}}
|
|
// cxx20-warning@#4 {{incompatible with C++ standards before C++20}}
|
|
|
|
explicit (operator+(A())) operator int(); // #5
|
|
// cxx17-error@#5 {{a type specifier is required}} cxx17-error@#5 {{expected ';'}}
|
|
// cxx17-warning@#5 {{will be parsed as explicit(bool)}}
|
|
// cxx20-warning@#5 {{incompatible with C++ standards before C++20}}
|
|
};
|
|
|
|
}
|