value-dependent-null-pointer-constant.cpp 465 B

1234567891011121314151617181920212223242526272829
  1. // RUN: %clang_cc1 -fsyntax-only %s
  2. template<typename T, int N>
  3. struct X0 {
  4. const char *f0(bool Cond) {
  5. return Cond? "honk" : N;
  6. }
  7. const char *f1(bool Cond) {
  8. return Cond? N : "honk";
  9. }
  10. bool f2(const char *str) {
  11. return str == N;
  12. }
  13. };
  14. // PR4996
  15. template<unsigned I> int f0() {
  16. return __builtin_choose_expr(I, 0, 1);
  17. }
  18. // PR5041
  19. struct A { };
  20. template <typename T> void f(T *t)
  21. {
  22. (void)static_cast<void*>(static_cast<A*>(t));
  23. }