Clang Project

clang_source_code/test/CodeGenCXX/thunk-returning-memptr.cpp
1// RUN: %clang_cc1 -triple=i686 -emit-llvm -o - %s | FileCheck %s
2
3
4struct X;
5typedef void (X::*memptr)();
6
7struct A {
8  virtual memptr f();
9};
10
11struct B {
12  virtual memptr f();
13};
14
15struct C : A, B {
16  C();
17  memptr f() override __attribute__((noinline)) { return nullptr; };
18};
19
20C::C() {}
21
22// Make sure the member pointer is returned from the thunk via the return slot.
23// Because of the tail call, the return value cannot be copied into a local
24// alloca. (PR39901)
25
26// CHECK-LABEL: define linkonce_odr void @_ZThn4_N1C1fEv({ i32, i32 }* noalias sret %agg.result, %struct.C* %this)
27// CHECK: tail call void @_ZN1C1fEv({ i32, i32 }* sret %agg.result
28