1 | // RUN: %clang_cc1 -std=c++14 -verify %s |
2 | |
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}} |
13 | } |
14 | class ArrayBuffer { |
15 | char data() { |
16 | visit([](auto buffer) -> char { // expected-note {{in instantiation}} |
17 | buffer->data(); |
18 | }); // expected-warning {{control reaches end of non-void lambda}} |
19 | } // expected-warning {{control reaches end of non-void function}} |
20 | }; |
21 | |
22 | // pr34185 |
23 | template <typename Promise> struct coroutine_handle { |
24 | Promise &promise() const { return |
25 | *static_cast<Promise *>(nullptr); // expected-warning {{binding dereferenced null}} |
26 | } |
27 | }; |
28 | |
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}} |
33 | } |
34 | }; |
35 | return Awaiter{}; |
36 | } |
37 | |
38 | void foo() { |
39 | auto &&p = GetCurrenPromise<int>(); // expected-note {{in instantiation}} |
40 | } |
41 | |