<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 11, 2013, at 22:19 , Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 18, 2013, at 6:54 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 18, 2013, at 18:52 , Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote"><div><br></div><div>When built in C++11 mode, we get this, which looks much more reasonable:</div><div><br></div><div><div>TranslationUnitDecl 0x5e9b0d0 <<invalid sloc>></div><div>|-TypedefDecl 0x5e9b610 <<invalid sloc>> __int128_t '__int128'</div>
<div>|-TypedefDecl 0x5e9b670 <<invalid sloc>> __uint128_t 'unsigned __int128'</div><div>|-TypedefDecl 0x5e9ba30 <<invalid sloc>> __builtin_va_list '__va_list_tag [1]'</div><div>|-TypedefDecl 0x5e9ba90 <tmp.c:1:1, col:14> NSInteger 'long'</div>
<div>|-<b>EnumDecl 0x5e9bb10 <line:2:9, col:14> PKPassKitErrorCode 'NSInteger':'long'</b></div><div>|-TypedefDecl 0x5e9bc10 <col:1, col:45> PKPassKitErrorCode 'enum PKPassKitErrorCode':'enum PKPassKitErrorCode'</div>
<div>`-<b>EnumDecl 0x5e9bca0 prev 0x5e9bb10 <col:65, line:7:1> PKPassKitErrorCode 'NSInteger':'long'</b></div><div>  |-<b>AvailabilityAttr 0x5ecea50 <col:18, col:49> ios 6.0 0 0 ""</b></div>
<div>  |-EnumConstantDecl 0x5e9bd80 <line:3:5, col:23> PKUnknownError 'enum PKPassKitErrorCode'</div><div>  | `-ImplicitCastExpr 0x5e9bd68 <col:22, col:23> 'NSInteger':'long' <IntegralCast></div>
<div>  |   `-UnaryOperator 0x5e9bd48 <col:22, col:23> 'int' prefix '-'</div><div>  |     `-IntegerLiteral 0x5e9bd28 <col:23> 'int' 1</div><div>  |-EnumConstantDecl 0x5ece960 <line:4:5, col:26> PKInvalidDataError 'enum PKPassKitErrorCode'</div>
<div>  | `-ImplicitCastExpr 0x5ece940 <col:26> 'NSInteger':'long' <IntegralCast></div><div>  |   `-IntegerLiteral 0x5e9bdd0 <col:26> 'int' 1</div><div>  |-EnumConstantDecl 0x5ece9b0 <line:5:5> PKUnsupportedVersionError 'enum PKPassKitErrorCode'</div>
<div>  `-EnumConstantDecl 0x5ecea00 <line:6:5> PKInvalidSignature 'enum PKPassKitErrorCode'</div></div></div></blockquote><br></div><div>Hm, may be an implementation quirk in Objective-C's version of forward-declared enums, then. Not sure if accidental or by design. Doug, do you happen to know offhand?</div></div></blockquote><br></div><div>I ran this with top-of-tree Clang under Objective-C, and I see:</div><div><br></div><div><div>|-TypedefDecl 0x7fcc2a827a90 <t.m:1:1, col:14> NSInteger 'long'</div><div>|-EnumDecl 0x7fcc2a827b10 <line:3:9, col:14> PKPassKitErrorCode 'NSInteger':'long'</div><div>|-TypedefDecl 0x7fcc2a859630 <col:1, col:45> PKPassKitErrorCode 'enum PKPassKitErrorCode':'enum PKPassKitErrorCode'</div><div>`-EnumDecl 0x7fcc2a8596a0 prev 0x7fcc2a827b10 <col:65, line:8:1> PKPassKitErrorCode 'NSInteger':'long'</div><div>  |-<b>AvailabilityAttr 0x7fcc2a859900 <col:18, col:49> ios 6.0 0 0 ""</b></div><div>  |-EnumConstantDecl 0x7fcc2a859780 <line:4:5, col:23> PKUnknownError 'NSInteger':'long'</div><div>  | `-ImplicitCastExpr 0x7fcc2a859768 <col:22, col:23> 'NSInteger':'long' <IntegralCast></div><div>  |   `-UnaryOperator 0x7fcc2a859748 <col:22, col:23> 'int' prefix '-'</div><div>  |     `-IntegerLiteral 0x7fcc2a859728 <col:23> 'int' 1</div><div>  |-EnumConstantDecl 0x7fcc2a859810 <line:5:5, col:26> PKInvalidDataError 'NSInteger':'long'</div><div>  | `-ImplicitCastExpr 0x7fcc2a8597f0 <col:26> 'NSInteger':'long' <IntegralCast></div><div>  |   `-IntegerLiteral 0x7fcc2a8597d0 <col:26> 'int' 1</div><div>  |-EnumConstantDecl 0x7fcc2a859860 <line:6:5> PKUnsupportedVersionError 'NSInteger':'long'</div><div>  `-EnumConstantDecl 0x7fcc2a8598b0 <line:7:5> PKInvalidSignature 'NSInteger':'long'</div><div><br></div><div>which looks correct (and identical to what happens in C++11 mode). I suspect that Sebastian's headers aren't expanding NS_ENUM the same way in Objective-C as in Objective-C++11.</div></div></div></blockquote><br></div><div>NS_ENUM isn't <i>defined</i> the same in Objective-C as in Objective-C++. </div><div><br></div><div>#define NS_ENUM(_type,_name) enum _name : _type _name; enum _name : _type<br><br></div><div>vs.</div><div><br></div><div>#define NS_ENUM(_type,_name) _type _name; enum<br><br></div><div>This has come up before—something about conversions. But aha! In Objective-C++, the enum is unnamed. Could that be part of the problem?</div><div><br></div><div>Jordan</div></body></html>