[LLVMbugs] [Bug 13701] New: Boxing untyped enum produces different number size

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 26 01:32:35 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13701

             Bug #: 13701
           Summary: Boxing untyped enum produces different number size
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: news at 1986.tv
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Here is a sample code I used to reproduce the issue:

typedef enum _MyEnum {
    MyEnumMember1 = 1000
} MyEnum;

- (void)testEnumerationBoxing
{
    NSNumber *numberA = [self testA];
    NSNumber *numberB = [self testB:MyEnumMember1];

    CFNumberType numberTypeA = CFNumberGetType((__bridge CFNumberRef) numberA);
    CFNumberType numberTypeB = CFNumberGetType((__bridge CFNumberRef) numberB);
}

- (NSNumber *)testA
{
    return @(MyEnumMember1);
}

- (NSNumber *)testB:(MyEnum)enumMember
{
    return @(enumMember);
}

Expected result:
numberTypeA should be the same as numberTypeB

Actual result:
numberTypeA is reported to be a 32 bit number while numberTypeB is a 64 bit
number

Note:
When enum defined as "typedef enum _MyEnum : int" both results are the same

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list