Files
TheRock/compiler/amd-llvm/clang/test/CXX/dcl.dcl/dcl.enum/p5.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

57 lines
2.0 KiB
C++

// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -verify %s
template<typename T> int force_same(T, T);
// C++ [dcl.enum]p5:
// [...] If the underlying type is not fixed, the type of each enumerator is
// the type of its initializing value:
// - If an initializer is specified for an enumerator, the initializing
// value has the same type as the expression.
enum Bullet1 {
Bullet1Val1 = 'a',
Bullet1Val2 = 10u,
Bullet1Val1IsChar = sizeof(force_same(Bullet1Val1, char(0))),
Bullet1Val2IsUnsigned = sizeof(force_same(Bullet1Val2, unsigned(0)))
};
// - If no initializer is specified for the first enumerator, the
// initializing value has an unspecified integral type.
enum Bullet2 {
Bullet2Val,
Bullet2ValIsInt = sizeof(force_same(Bullet2Val, int(0)))
};
// - Otherwise the type of the initializing value is the same as the type
// of the initializing value of the preceding enumerator unless the
// incremented value is not representable in that type, in which case the
// type is an unspecified integral type sufficient to contain the
// incremented value. If no such type exists, the program is ill-formed.
enum Bullet3a {
Bullet3aVal1 = 17,
Bullet3aVal2,
Bullet3aVal2IsInt = sizeof(force_same(Bullet3aVal2, int(0))),
Bullet3aVal3 = 2147483647,
Bullet3aVal3IsInt = sizeof(force_same(Bullet3aVal3, int(0))),
Bullet3aVal4,
Bullet3aVal4IsUnsigned = sizeof(force_same(Bullet3aVal4, 0ul))
};
enum Bullet3b {
Bullet3bVal1 = 17u,
Bullet3bVal2,
Bullet3bVal2IsInt = sizeof(force_same(Bullet3bVal2, 0u)),
Bullet3bVal3 = 2147483647u,
Bullet3bVal3IsInt = sizeof(force_same(Bullet3bVal3, 0u)),
Bullet3bVal4,
Bullet3bVal4IsUnsigned = sizeof(force_same(Bullet3bVal4, 0ul))
};
enum Bullet3c {
Bullet3cVal1 = 0xFFFFFFFFFFFFFFFEull,
Bullet3cVal2,
Bullet3cVal3 // expected-warning{{not representable}}
};
// Following the closing brace of an enum-specifier, each enumerator has the
// type of its enumeration.
int array0[sizeof(force_same(Bullet3bVal3, Bullet3b(0)))? 1 : -1];