[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / late-parsing-eager-instantiation.cpp
blob0e654768787aaef3282536cac40b7d7072e6bd2c
1 // RUN: %clang_cc1 -std=c++14 -verify %s
3 // pr33561
4 class ArrayBuffer;
5 template <typename T> class Trans_NS_WTF_RefPtr {
6 public:
7 ArrayBuffer *operator->() { return nullptr; }
8 };
9 Trans_NS_WTF_RefPtr<ArrayBuffer> get();
10 template <typename _Visitor>
11 constexpr void visit(_Visitor __visitor) {
12 __visitor(get()); // expected-note {{in instantiation}}
14 class ArrayBuffer {
15 char data() {
16 visit([](auto buffer) -> char { // expected-note {{in instantiation}}
17 buffer->data();
18 }); // expected-warning {{non-void lambda does not return a value}}
19 } // expected-warning {{non-void function does not return a value}}
22 // pr34185
23 template <typename Promise> struct coroutine_handle {
24 Promise &promise() const { return
25 *static_cast<Promise *>(nullptr); // expected-warning {{binding dereferenced null}}
29 template <typename Promise> auto GetCurrenPromise() {
30 struct Awaiter { // expected-note {{in instantiation}}
31 void await_suspend(coroutine_handle<Promise> h) {
32 h.promise(); // expected-note {{in instantiation}}
35 return Awaiter{};
38 void foo() {
39 auto &&p = GetCurrenPromise<int>(); // expected-note {{in instantiation}}