xref: /llvm-project/clang/test/CodeGenCXX/scoped-enums.cpp (revision c9bd88e6811fb622cde644a82eac41c0b02c00ee)
1*c9bd88e6SHans Wennborg // RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
26ab2fa8fSDouglas Gregor 
36ab2fa8fSDouglas Gregor // PR9923
46ab2fa8fSDouglas Gregor enum class Color { red, blue, green };
56ab2fa8fSDouglas Gregor 
66ab2fa8fSDouglas Gregor void f(Color);
g()76ab2fa8fSDouglas Gregor void g() {
86ab2fa8fSDouglas Gregor   f(Color::red);
96ab2fa8fSDouglas Gregor }
10c60dc718SAdrian Prantl 
11c60dc718SAdrian Prantl // See that struct is handled equally.
12c60dc718SAdrian Prantl enum struct Colour { grey };
13c60dc718SAdrian Prantl 
14c60dc718SAdrian Prantl void h(Colour);
i()15c60dc718SAdrian Prantl void i() {
16c60dc718SAdrian Prantl   h(Colour::grey);
17c60dc718SAdrian Prantl }
1849a497faSRichard Smith 
1949a497faSRichard Smith enum struct PR17103 : int { a = -1, b = 1 };
cmp(PR17103 x,PR17103 y)2049a497faSRichard Smith bool cmp(PR17103 x, PR17103 y) { return x < y; }
2149a497faSRichard Smith 
2249a497faSRichard Smith // CHECK-LABEL: @_Z3cmp7PR17103S_(
2349a497faSRichard Smith // CHECK-NOT: }
2449a497faSRichard Smith // CHECK: icmp slt
25