150
|
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
|
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
|
4
|
|
5 template<typename T, int N>
|
|
6 struct X0 {
|
|
7 const char *f0(bool Cond) {
|
|
8 return Cond? "honk" : N;
|
|
9 #if __cplusplus >= 201103L
|
|
10 // expected-error@-2 {{incompatible operand types ('const char *' and 'int')}}
|
|
11 #else
|
|
12 // expected-no-diagnostics
|
|
13 #endif
|
|
14 }
|
|
15
|
|
16 const char *f1(bool Cond) {
|
|
17 return Cond? N : "honk";
|
|
18 #if __cplusplus >= 201103L
|
|
19 // expected-error@-2 {{incompatible operand types ('int' and 'const char *')}}
|
|
20 #endif
|
|
21 }
|
|
22
|
|
23 bool f2(const char *str) {
|
|
24 return str == N;
|
|
25 #if __cplusplus >= 201103L
|
|
26 // expected-error@-2 {{comparison between pointer and integer ('const char *' and 'int')}}
|
|
27 #endif
|
|
28 }
|
|
29 };
|
|
30
|
|
31 // PR4996
|
|
32 template<unsigned I> int f0() {
|
|
33 return __builtin_choose_expr(I, 0, 1);
|
|
34 }
|
|
35
|
|
36 // PR5041
|
|
37 struct A { };
|
|
38
|
|
39 template <typename T> void f(T *t)
|
|
40 {
|
|
41 (void)static_cast<void*>(static_cast<A*>(t));
|
|
42 }
|