1 // Tests that we wouldn't generate an allocation call in global scope with (std::size_t, p0, ..., pn)
2 // RUN: %clang_cc1 %s -std=c++20 -S -triple x86_64-unknown-linux-gnu -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
3 #include "Inputs/coroutine.h"
4 
5 namespace std {
6 typedef decltype(sizeof(int)) size_t;
7 }
8 
9 struct Allocator {};
10 
11 struct resumable {
12   struct promise_type {
13 
14     resumable get_return_object() { return {}; }
15     auto initial_suspend() { return std::suspend_always(); }
16     auto final_suspend() noexcept { return std::suspend_always(); }
17     void unhandled_exception() {}
18     void return_void(){};
19   };
20 };
21 
22 void *operator new(std::size_t, void *);
23 
24 resumable f1(void *) {
25   co_return;
26 }
27 
28 // CHECK: coro.alloc:
29 // CHECK-NEXT: [[SIZE:%.+]] = call [[BITWIDTH:.+]] @llvm.coro.size.[[BITWIDTH]]()
30 // CHECK-NEXT: call {{.*}} ptr @_Znwm([[BITWIDTH]] noundef [[SIZE]])
31