[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CXX / drs / cwg118.cpp
blob04e19ce050788cd0a270a17b729096eacc6f7d4a
1 // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
2 // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
3 // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
4 // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
6 // cwg118: yes
8 struct S {
9 virtual void f();
11 void (S::*pmf)();
13 // CHECK-LABEL: define {{.*}} @_Z1g
14 void g(S *sp) {
15 // CHECK: call void %
16 sp->f(); // 1: polymorphic
17 // CHECK: call void @
18 sp->S::f(); // 2: non-polymorphic
19 // CHECK: call void @
20 (sp->S::f)(); // 3: non-polymorphic
21 // CHECK: call void %
22 (sp->*pmf)(); // 4: polymorphic
23 // CHECK: call void %
24 (sp->*&S::f)(); // 5: polymorphic