xref: /llvm-project/clang/test/CXX/drs/cwg118.cpp (revision 327e2b7c7659e2fff2e644850b767ca77234bef4)
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++17 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
5 // RUN: %clang_cc1 -triple x86_64-linux -std=c++20 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
6 // RUN: %clang_cc1 -triple x86_64-linux -std=c++23 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
7 // RUN: %clang_cc1 -triple x86_64-linux -std=c++2c %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call "
8 
9 
10 // cwg118: yes
11 
12 struct S {
13   virtual void f();
14 };
15 void (S::*pmf)();
16 
17 // CHECK-LABEL: define {{.*}} @_Z1g
18 void g(S *sp) {
19   // CHECK: call void %
20   sp->f();        // 1: polymorphic
21   // CHECK: call void @
22   sp->S::f();     // 2: non-polymorphic
23   // CHECK: call void @
24   (sp->S::f)();   // 3: non-polymorphic
25   // CHECK: call void %
26   (sp->*pmf)();   // 4: polymorphic
27   // CHECK: call void %
28   (sp->*&S::f)(); // 5: polymorphic
29 }
30 
31