Andy Kaylor 4ed0ff8756
[CIR] Add support for using enum constants (#143214)
Although support for declaring enums and using values whose type was an
enum was previously upstreamed, we didn't have support for referencing
the constant values declared in the enum. This change adds that support.
2025-06-09 09:19:31 -07:00

17 lines
298 B
C++

// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck %s --input-file=%t.cir
enum Numbers {
Zero,
One,
Two,
Three
};
int f() {
return Numbers::One;
}
// CHECK: cir.func{{.*}} @_Z1fv
// CHECK: cir.const #cir.int<1> : !u32i