brintos

brintos / llvm-project-archived public Read only

0
0
Text · 967 B · 29fd15e Raw
43 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5template<typename T, int N>6struct X0 {7  const char *f0(bool Cond) {8    return Cond? "honk" : N;9#if __cplusplus >= 201103L10// expected-error@-2 {{incompatible operand types ('const char *' and 'int')}}11#else12// expected-no-diagnostics13#endif14  }15 16  const char *f1(bool Cond) {17    return Cond? N : "honk";18#if __cplusplus >= 201103L19// expected-error@-2 {{incompatible operand types ('int' and 'const char *')}}20#endif21  }22  23  bool f2(const char *str) {24    return str == N;25#if __cplusplus >= 201103L26// expected-error@-2 {{comparison between pointer and integer ('const char *' and 'int')}}27#endif28  }29};30 31// PR499632template<unsigned I> int f0() { 33  return __builtin_choose_expr(I, 0, 1); 34}35 36// PR504137struct A { };38 39template <typename T> void f(T *t)40{41  (void)static_cast<void*>(static_cast<A*>(t));42}43