• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
operator ->()7   ArrayBuffer *operator->() { return nullptr; }
8 };
9 Trans_NS_WTF_RefPtr<ArrayBuffer> get();
10 template <typename _Visitor>
visit(_Visitor __visitor)11 constexpr void visit(_Visitor __visitor) {
12   __visitor(get()); // expected-note {{in instantiation}}
13 }
14 class ArrayBuffer {
data()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}}
20 };
21 
22 // pr34185
23 template <typename Promise> struct coroutine_handle {
promisecoroutine_handle24   Promise &promise() const { return
25     *static_cast<Promise *>(nullptr); // expected-warning {{binding dereferenced null}}
26   }
27 };
28 
GetCurrenPromise()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 
foo()38 void foo() {
39   auto &&p = GetCurrenPromise<int>(); // expected-note {{in instantiation}}
40 }
41