Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6'
      2 // RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7'
      3 
      4 // This test case illustrates a peculiarity of the promotion of
      5 // enumeration types in C and C++. In particular, the enumeration type
      6 // "z" below promotes to an unsigned int in C but int in C++.
      7 static enum { foo, bar = 1U } z;
      8 
      9 int main (void)
     10 {
     11   int r = 0;
     12 
     13   if (bar - 2 < 0)
     14     r += 4;
     15   if (foo - 1 < 0)
     16     r += 2;
     17   if (z - 1 < 0)
     18     r++;
     19 
     20   return r;
     21 }
     22 
     23