Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 9103bb2 | 2008-12-17 22:52:20 +0000 | [diff] [blame] | 2 | class X { |
| 3 | public: |
| 4 | virtual int f(); |
| 5 | }; |
Douglas Gregor | 898574e | 2008-12-05 23:32:09 +0000 | [diff] [blame] | 6 | |
Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 7 | void g(int); // expected-note{{candidate function}} |
Douglas Gregor | 898574e | 2008-12-05 23:32:09 +0000 | [diff] [blame] | 8 | |
| 9 | template<typename T> |
| 10 | T f(T x) { |
| 11 | (void)(x + 0); |
| 12 | (void)T(0); |
| 13 | (void)(x += 0); |
| 14 | (void)(x? x : x); |
Douglas Gregor | 9103bb2 | 2008-12-17 22:52:20 +0000 | [diff] [blame] | 15 | (void)static_cast<int>(x); |
| 16 | (void)reinterpret_cast<int>(x); |
| 17 | (void)dynamic_cast<X*>(&x); |
| 18 | (void)const_cast<int>(x); |
Douglas Gregor | 898574e | 2008-12-05 23:32:09 +0000 | [diff] [blame] | 19 | return g(x); |
Douglas Gregor | 5c37de7 | 2008-12-06 00:22:45 +0000 | [diff] [blame] | 20 | h(x); // h is a dependent name |
Douglas Gregor | fa04764 | 2009-02-04 00:32:51 +0000 | [diff] [blame] | 21 | g(1, 1); // expected-error{{no matching function for call}} |
John McCall | 578b69b | 2009-12-16 08:11:27 +0000 | [diff] [blame] | 22 | h(1); // expected-error{{use of undeclared identifier 'h'}} |
Douglas Gregor | 898574e | 2008-12-05 23:32:09 +0000 | [diff] [blame] | 23 | return 0; |
| 24 | } |
Argyrios Kyrtzidis | 63b57ae | 2010-10-07 21:52:18 +0000 | [diff] [blame] | 25 | |
| 26 | // This one entered into an infinite loop. |
| 27 | template <unsigned long N> |
| 28 | void rdar8520617() { |
Douglas Gregor | 3e026e3 | 2011-02-19 22:34:59 +0000 | [diff] [blame] | 29 | if (N > 1) { } |
Argyrios Kyrtzidis | 63b57ae | 2010-10-07 21:52:18 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | int f2() { |
Douglas Gregor | 3e026e3 | 2011-02-19 22:34:59 +0000 | [diff] [blame] | 33 | rdar8520617<0>(); |
Argyrios Kyrtzidis | 63b57ae | 2010-10-07 21:52:18 +0000 | [diff] [blame] | 34 | } |
| 35 | |