Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/member-enum-declarations.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

113 lines
2.3 KiB
C++

// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
// RUN: %clang_cc1 -std=c++14 -fsyntax-only %s -verify
// RUN: %clang_cc1 -std=c++20 -fsyntax-only %s -verify
namespace ScopedEnumerations {
template <typename T>
struct S1 {
enum class E : T;
};
template <typename T>
enum class S1<T>::E : T {
S1_X = 0x123
};
static_assert(static_cast<int>(S1<int>::E::S1_X) == 0x123, "");
template <typename T>
struct S2 {
static constexpr T f(int) { return 0; };
enum class E : T;
static constexpr T f(char) { return 1; };
enum class E : T { X = f(T{}) };
};
static_assert(static_cast<int>(S2<char>::E::X) == 1, "");
template <typename T>
struct S3 {
enum class E : T;
enum class E : T { X = 0x7FFFFF00 }; // expected-error {{cannot be narrowed to type 'char'}} expected-warning {{implicit conversion from 'int' to 'char'}}
};
template struct S3<char>; // expected-note {{in instantiation}}
template <typename T>
struct S4 {
enum class E : T;
enum class E : T { S4_X = 5 };
};
auto x4 = S4<int>::E::S4_X;
template <typename T>
T f1() {
enum class E : T { X_F1, Y_F1, Z_F1 };
return X_F1; // expected-error {{use of undeclared identifier 'X_F1'}}
}
const int resf1 = f1<int>();
}
namespace UnscopedEnumerations {
template <typename T>
struct S1 {
enum E : T;
};
template <typename T>
enum S1<T>::E : T {
S1_X = 0x123
};
static_assert(static_cast<int>(S1<int>::S1_X) == 0x123, "");
template <typename T>
struct S2 {
static constexpr T f(int) { return 0; };
enum E : T;
static constexpr T f(char) { return 1; };
enum E : T { S2_X = f(T{}) };
};
static_assert(static_cast<int>(S2<char>::E::S2_X) == 1, "");
template <typename T>
struct S3 {
enum E : T;
enum E : T { S3_X = 0x7FFFFF00 }; // expected-error {{cannot be narrowed to type 'char'}} expected-warning {{implicit conversion from 'int' to 'char'}}
};
template struct S3<char>; // expected-note {{in instantiation of template class}}
template <typename T>
struct S4 {
enum E : T;
enum E : T { S4_X = 5 };
};
auto x4 = S4<int>::S4_X;
template <typename T>
struct S5 {
enum E : T;
T S5_X = 5; // expected-note {{previous definition is here}}
enum E : T { S5_X = 5 }; // expected-error {{redefinition of 'S5_X'}}
};
template <typename T>
T f1() {
enum E : T { X_F2, Y_F2, Z_F2 };
return X_F2;
}
const int resf1 = f1<int>();
}