Skip to content

Instantly share code, notes, and snippets.

@tcosprojects
Created October 3, 2016 11:31
Show Gist options
  • Select an option

  • Save tcosprojects/49d0c809d40b8f008e25dacf49c508bf to your computer and use it in GitHub Desktop.

Select an option

Save tcosprojects/49d0c809d40b8f008e25dacf49c508bf to your computer and use it in GitHub Desktop.
#include <stdio.h>
typedef enum {
Invalid = 0,
Unexposed = 1,
Void = 2,
Bool = 3,
Char_U = 4,
UChar = 5,
Char16 = 6,
Char32 = 7,
UShort = 8,
UInt = 9,
ULong = 10,
ULongLong = 11,
UInt128 = 12,
Char_S = 13,
SChar = 14,
WChar = 15,
Short = 16,
Int = 17,
Long = 18,
LongLong = 19,
Int128 = 20,
Float = 21,
Double = 22,
LongDouble = 23,
NullPtr = 24,
Overload = 25,
Dependent = 26,
ObjCId = 27,
ObjCClass = 28,
ObjCSel = 29,
Complex = 100,
Pointer = 101,
BlockPointer = 102,
LValueReference = 103,
RValueReference = 104,
Record = 105,
Enum = 106,
Typedef = 107,
ObjCInterface = 108,
ObjCObjectPointer = 109,
FunctionNoProto = 110,
FunctionProto = 111,
ConstantArray = 112,
Vector = 113,
IncompleteArray = 114,
VariableArray = 115,
DependentSizedArray = 116,
MemberPointer = 117
} CXTypeKind;
CXTypeKind get_bad_kind() {
return (CXTypeKind)119;
}
int test() {
switch(get_bad_kind()) {
case Void:
case Invalid:
return 2;
case Bool:
return 3;
case SChar:
case Char_S:
return 30;
case UChar:
case Char_U:
return 31;
case UShort:
return 32;
case UInt:
return 33;
case ULong:
return 34;
case ULongLong:
return 35;
case Short:
return 36;
case Int:
return 37;
case Long:
return 38;
case LongLong:
return 39;
case WChar:
return 40;
case Float:
return 41;
case Double:
case LongDouble:
return 42;
case Pointer:
return 43;
case VariableArray:
return 0;
case DependentSizedArray:
case IncompleteArray:
return 62;
case FunctionProto:
case FunctionNoProto:
return 70;
case Record:
case Typedef:
case Unexposed:
case Enum:
return 88;
case ConstantArray:
return 96;
case Vector:
return 111;
case Int128:
case UInt128:
return 128;
default:
return -1;
}
}
int main()
{
printf("%d\n", test());
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment