xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/value-dependent-null-pointer-constant.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc template<typename T, int N>
4*f4a2713aSLionel Sambuc struct X0 {
f0X05*f4a2713aSLionel Sambuc   const char *f0(bool Cond) {
6*f4a2713aSLionel Sambuc     return Cond? "honk" : N;
7*f4a2713aSLionel Sambuc   }
8*f4a2713aSLionel Sambuc 
f1X09*f4a2713aSLionel Sambuc   const char *f1(bool Cond) {
10*f4a2713aSLionel Sambuc     return Cond? N : "honk";
11*f4a2713aSLionel Sambuc   }
12*f4a2713aSLionel Sambuc 
f2X013*f4a2713aSLionel Sambuc   bool f2(const char *str) {
14*f4a2713aSLionel Sambuc     return str == N;
15*f4a2713aSLionel Sambuc   }
16*f4a2713aSLionel Sambuc };
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc // PR4996
f0()19*f4a2713aSLionel Sambuc template<unsigned I> int f0() {
20*f4a2713aSLionel Sambuc   return __builtin_choose_expr(I, 0, 1);
21*f4a2713aSLionel Sambuc }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // PR5041
24*f4a2713aSLionel Sambuc struct A { };
25*f4a2713aSLionel Sambuc 
f(T * t)26*f4a2713aSLionel Sambuc template <typename T> void f(T *t)
27*f4a2713aSLionel Sambuc {
28*f4a2713aSLionel Sambuc   (void)static_cast<void*>(static_cast<A*>(t));
29*f4a2713aSLionel Sambuc }
30