Home | History | Annotate | Download | only in Sema
      1 // RUN: %clang_cc1 -fsyntax-only %s -verify
      2 
      3 typedef struct { unsigned long bits[(((1) + (64) - 1) / (64))]; } cpumask_t;
      4 cpumask_t x;
      5 void foo() {
      6   (void)x;
      7 }
      8 void bar() {
      9   char* a;
     10   double b;
     11   b = (double)a; // expected-error {{pointer cannot be cast to type}}
     12   a = (char*)b; // expected-error {{cannot be cast to a pointer type}}
     13 }
     14 
     15 long bar1(long *next) {
     16         return (long)(*next)++;
     17 }
     18 
     19 typedef _Bool Bool;
     20 typedef int Int;
     21 typedef long Long;
     22 typedef float Float;
     23 typedef double Double;
     24 typedef _Complex int CInt;
     25 typedef _Complex long CLong;
     26 typedef _Complex float CFloat;
     27 typedef _Complex double CDouble;
     28 typedef void *VoidPtr;
     29 typedef char *CharPtr;
     30 
     31 void testBool(Bool v) {
     32   (void) (Bool) v;
     33   (void) (Int) v;
     34   (void) (Long) v;
     35   (void) (Float) v;
     36   (void) (Double) v;
     37   (void) (CInt) v;
     38   (void) (CLong) v;
     39   (void) (CFloat) v;
     40   (void) (CDouble) v;
     41   (void) (VoidPtr) v;
     42   (void) (CharPtr) v;
     43 }
     44 
     45 void testInt(Int v) {
     46   (void) (Bool) v;
     47   (void) (Int) v;
     48   (void) (Long) v;
     49   (void) (Float) v;
     50   (void) (Double) v;
     51   (void) (CInt) v;
     52   (void) (CLong) v;
     53   (void) (CFloat) v;
     54   (void) (CDouble) v;
     55   (void) (VoidPtr) v;
     56   (void) (CharPtr) v;
     57 }
     58 
     59 void testLong(Long v) {
     60   (void) (Bool) v;
     61   (void) (Int) v;
     62   (void) (Long) v;
     63   (void) (Float) v;
     64   (void) (Double) v;
     65   (void) (CInt) v;
     66   (void) (CLong) v;
     67   (void) (CFloat) v;
     68   (void) (CDouble) v;
     69   (void) (VoidPtr) v;
     70   (void) (CharPtr) v;
     71 }
     72 
     73 void testFloat(Float v) {
     74   (void) (Bool) v;
     75   (void) (Int) v;
     76   (void) (Long) v;
     77   (void) (Float) v;
     78   (void) (Double) v;
     79   (void) (CInt) v;
     80   (void) (CLong) v;
     81   (void) (CFloat) v;
     82   (void) (CDouble) v;
     83 }
     84 
     85 void testDouble(Double v) {
     86   (void) (Bool) v;
     87   (void) (Int) v;
     88   (void) (Long) v;
     89   (void) (Float) v;
     90   (void) (Double) v;
     91   (void) (CInt) v;
     92   (void) (CLong) v;
     93   (void) (CFloat) v;
     94   (void) (CDouble) v;
     95 }
     96 
     97 void testCI(CInt v) {
     98   (void) (Bool) v;
     99   (void) (Int) v;
    100   (void) (Long) v;
    101   (void) (Float) v;
    102   (void) (Double) v;
    103   (void) (CInt) v;
    104   (void) (CLong) v;
    105   (void) (CFloat) v;
    106   (void) (CDouble) v;
    107 }
    108 
    109 void testCLong(CLong v) {
    110   (void) (Bool) v;
    111   (void) (Int) v;
    112   (void) (Long) v;
    113   (void) (Float) v;
    114   (void) (Double) v;
    115   (void) (CInt) v;
    116   (void) (CLong) v;
    117   (void) (CFloat) v;
    118   (void) (CDouble) v;
    119 }
    120 
    121 void testCFloat(CFloat v) {
    122   (void) (Bool) v;
    123   (void) (Int) v;
    124   (void) (Long) v;
    125   (void) (Float) v;
    126   (void) (Double) v;
    127   (void) (CInt) v;
    128   (void) (CLong) v;
    129   (void) (CFloat) v;
    130   (void) (CDouble) v;
    131 }
    132 
    133 void testCDouble(CDouble v) {
    134   (void) (Bool) v;
    135   (void) (Int) v;
    136   (void) (Long) v;
    137   (void) (Float) v;
    138   (void) (Double) v;
    139   (void) (CInt) v;
    140   (void) (CLong) v;
    141   (void) (CFloat) v;
    142   (void) (CDouble) v;
    143 }
    144 
    145 void testVoidPtr(VoidPtr v) {
    146   (void) (Bool) v;
    147   (void) (Int) v;
    148   (void) (Long) v;
    149   (void) (VoidPtr) v;
    150   (void) (CharPtr) v;
    151 }
    152 
    153 void testCharPtr(CharPtr v) {
    154   (void) (Bool) v;
    155   (void) (Int) v;
    156   (void) (Long) v;
    157   (void) (VoidPtr) v;
    158   (void) (CharPtr) v;
    159 }
    160