36 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2class X { 3public:4 virtual int f();5};6 7void g(int); // expected-note{{candidate function}}8 9template<typename T>10T f(T x) {11 (void)(x + 0);12 (void)T(0);13 (void)(x += 0);14 (void)(x? x : x);15 (void)static_cast<int>(x);16 (void)reinterpret_cast<int>(x);17 (void)dynamic_cast<X*>(&x);18 (void)const_cast<int>(x);19 return g(x);20 h(x); // h is a dependent name21 g(1, 1); // expected-error{{no matching function for call}}22 h(1); // expected-error{{use of undeclared identifier 'h'}}23 return 0;24}25 26// This one entered into an infinite loop.27template <unsigned long N>28void rdar8520617() {29 if (N > 1) { }30}31 32int f2() {33 rdar8520617<0>();34}35 36