blob: 398c3cb0339bb1f8e40f7823429bcc11041101c2 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor9103bb22008-12-17 22:52:20 +00002class X {
3public:
4 virtual int f();
5};
Douglas Gregor898574e2008-12-05 23:32:09 +00006
Douglas Gregorfa047642009-02-04 00:32:51 +00007void g(int); // expected-note{{candidate function}}
Douglas Gregor898574e2008-12-05 23:32:09 +00008
9template<typename T>
10T f(T x) {
11 (void)(x + 0);
12 (void)T(0);
13 (void)(x += 0);
14 (void)(x? x : x);
Douglas Gregor9103bb22008-12-17 22:52:20 +000015 (void)static_cast<int>(x);
16 (void)reinterpret_cast<int>(x);
17 (void)dynamic_cast<X*>(&x);
18 (void)const_cast<int>(x);
Douglas Gregor898574e2008-12-05 23:32:09 +000019 return g(x);
Douglas Gregor5c37de72008-12-06 00:22:45 +000020 h(x); // h is a dependent name
Douglas Gregorfa047642009-02-04 00:32:51 +000021 g(1, 1); // expected-error{{no matching function for call}}
John McCall578b69b2009-12-16 08:11:27 +000022 h(1); // expected-error{{use of undeclared identifier 'h'}}
Douglas Gregor898574e2008-12-05 23:32:09 +000023 return 0;
24}
Argyrios Kyrtzidis63b57ae2010-10-07 21:52:18 +000025
26// This one entered into an infinite loop.
27template <unsigned long N>
28void rdar8520617() {
Douglas Gregor3e026e32011-02-19 22:34:59 +000029 if (N > 1) { }
Argyrios Kyrtzidis63b57ae2010-10-07 21:52:18 +000030}
31
32int f2() {
Douglas Gregor3e026e32011-02-19 22:34:59 +000033 rdar8520617<0>();
Argyrios Kyrtzidis63b57ae2010-10-07 21:52:18 +000034}
35