From 89deb3f041a1aa2e302b8cd778095ad2cac5e4d7 Mon Sep 17 00:00:00 2001
From: Argyrios Kyrtzidis NSNumber
creation method.
+Boxing a value of enum type will result in a NSNumber
pointer with a creation method according to the underlying type of the enum,
+which can be a fixed underlying type or a compiler-defined
+integer type capable of representing the values of all the members of the enumeration:
+
+typedef enum : unsigned char { Red, Green, Blue } Color; +Color col = Red; +NSNumber *nsCol = @(col); // => [NSNumber numberWithUnsignedChar:] ++
diff --git a/test/CodeGenObjC/boxing.m b/test/CodeGenObjC/boxing.m index 3c24779f9a..9664298154 100644 --- a/test/CodeGenObjC/boxing.m +++ b/test/CodeGenObjC/boxing.m @@ -85,4 +85,11 @@ int main() { @((NSUInteger)i); // CHECK: load i8** [[stringWithUTF8StringSEL]] const char *s; @(s); + + typedef enum : NSInteger { Red, Green, Blue } Color; + // CHECK: load i8** [[WithIntegerSEL]] + @(Red); + Color col = Red; + // CHECK: load i8** [[WithIntegerSEL]] + @(col); } -- 2.40.0