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