[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / type-dependent-exprs.cpp
blob398c3cb0339bb1f8e40f7823429bcc11041101c2
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 class X {
3 public:
4 virtual int f();
5 };
7 void g(int); // expected-note{{candidate function}}
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);
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 name
21 g(1, 1); // expected-error{{no matching function for call}}
22 h(1); // expected-error{{use of undeclared identifier 'h'}}
23 return 0;
26 // This one entered into an infinite loop.
27 template <unsigned long N>
28 void rdar8520617() {
29 if (N > 1) { }
32 int f2() {
33 rdar8520617<0>();