1*9ea0817cSCharles Li // RUN: %clang_cc1 -fsyntax-only -verify %s
2*9ea0817cSCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3*9ea0817cSCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
456751b59SDouglas Gregor 
556751b59SDouglas Gregor template<typename T, int N>
656751b59SDouglas Gregor struct X0 {
f0X0756751b59SDouglas Gregor   const char *f0(bool Cond) {
856751b59SDouglas Gregor     return Cond? "honk" : N;
9*9ea0817cSCharles Li #if __cplusplus >= 201103L
10*9ea0817cSCharles Li // expected-error@-2 {{incompatible operand types ('const char *' and 'int')}}
11*9ea0817cSCharles Li #else
12*9ea0817cSCharles Li // expected-no-diagnostics
13*9ea0817cSCharles Li #endif
1456751b59SDouglas Gregor   }
1556751b59SDouglas Gregor 
f1X01656751b59SDouglas Gregor   const char *f1(bool Cond) {
1756751b59SDouglas Gregor     return Cond? N : "honk";
18*9ea0817cSCharles Li #if __cplusplus >= 201103L
19*9ea0817cSCharles Li // expected-error@-2 {{incompatible operand types ('int' and 'const char *')}}
20*9ea0817cSCharles Li #endif
2156751b59SDouglas Gregor   }
2256751b59SDouglas Gregor 
f2X02356751b59SDouglas Gregor   bool f2(const char *str) {
2456751b59SDouglas Gregor     return str == N;
25*9ea0817cSCharles Li #if __cplusplus >= 201103L
26*9ea0817cSCharles Li // expected-error@-2 {{comparison between pointer and integer ('const char *' and 'int')}}
27*9ea0817cSCharles Li #endif
2856751b59SDouglas Gregor   }
2956751b59SDouglas Gregor };
3056751b59SDouglas Gregor 
3156751b59SDouglas Gregor // PR4996
f0()3256751b59SDouglas Gregor template<unsigned I> int f0() {
3356751b59SDouglas Gregor   return __builtin_choose_expr(I, 0, 1);
3456751b59SDouglas Gregor }
3556751b59SDouglas Gregor 
3656751b59SDouglas Gregor // PR5041
3756751b59SDouglas Gregor struct A { };
3856751b59SDouglas Gregor 
f(T * t)3956751b59SDouglas Gregor template <typename T> void f(T *t)
4056751b59SDouglas Gregor {
4156751b59SDouglas Gregor   (void)static_cast<void*>(static_cast<A*>(t));
4256751b59SDouglas Gregor }
43