2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only %s -verify
|
2007-10-29 12:26:44 +08:00
|
|
|
|
|
|
|
typedef struct { unsigned long bits[(((1) + (64) - 1) / (64))]; } cpumask_t;
|
|
|
|
cpumask_t x;
|
|
|
|
void foo() {
|
|
|
|
(void)x;
|
|
|
|
}
|
2009-05-01 10:23:58 +08:00
|
|
|
void bar() {
|
|
|
|
char* a;
|
|
|
|
double b;
|
|
|
|
b = (double)a; // expected-error {{pointer cannot be cast to type}}
|
|
|
|
a = (char*)b; // expected-error {{cannot be cast to a pointer type}}
|
|
|
|
}
|
2007-10-29 12:26:44 +08:00
|
|
|
|
2009-11-24 03:51:43 +08:00
|
|
|
long bar1(long *next) {
|
|
|
|
return (long)(*next)++;
|
|
|
|
}
|
|
|
|
|
2010-12-29 01:19:27 +08:00
|
|
|
typedef _Bool Bool;
|
|
|
|
typedef int Int;
|
|
|
|
typedef long Long;
|
|
|
|
typedef float Float;
|
|
|
|
typedef double Double;
|
|
|
|
typedef _Complex int CInt;
|
|
|
|
typedef _Complex long CLong;
|
|
|
|
typedef _Complex float CFloat;
|
|
|
|
typedef _Complex double CDouble;
|
|
|
|
typedef void *VoidPtr;
|
|
|
|
typedef char *CharPtr;
|
|
|
|
|
|
|
|
void testBool(Bool v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
(void) (VoidPtr) v;
|
|
|
|
(void) (CharPtr) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testInt(Int v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
(void) (VoidPtr) v;
|
|
|
|
(void) (CharPtr) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testLong(Long v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
(void) (VoidPtr) v;
|
|
|
|
(void) (CharPtr) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testFloat(Float v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testDouble(Double v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCI(CInt v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCLong(CLong v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCFloat(CFloat v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCDouble(CDouble v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (Float) v;
|
|
|
|
(void) (Double) v;
|
|
|
|
(void) (CInt) v;
|
|
|
|
(void) (CLong) v;
|
|
|
|
(void) (CFloat) v;
|
|
|
|
(void) (CDouble) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testVoidPtr(VoidPtr v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (VoidPtr) v;
|
|
|
|
(void) (CharPtr) v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void testCharPtr(CharPtr v) {
|
|
|
|
(void) (Bool) v;
|
|
|
|
(void) (Int) v;
|
|
|
|
(void) (Long) v;
|
|
|
|
(void) (VoidPtr) v;
|
|
|
|
(void) (CharPtr) v;
|
|
|
|
}
|