// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.experimental.CStyleCasts -verify %s

void foo1() {
  int i;
  char b = 0;

  // Check if basic C style cast generates a warning.
  i = (int)b;  // expected-warning{{Using  a C style cast is deprecated. Use a more specific C++ style cast instead.}}
}

void foo2() {
  typedef int tint;
  int i;
  char b = 0;

  // Check if typedefs get picked up properly.
  i = (tint)b;  // expected-warning{{Using  a C style cast is deprecated. Use a more specific C++ style cast instead.}}
}

void foo3() {
  int *ip;
  char b = 0;

  // Check if a pointer cast generates a warning.
  ip = (int *)&b;  // expected-warning{{Using  a C style cast is deprecated. Use a more specific C++ style cast instead.}}
}

void foo4() {
  int i;
  char b = 0;

  // Just to show that C++ casts don't generate a warning.
  i = static_cast<int>(b);  // no-warning
}

