Clang Project

clang_source_code/test/CXX/drs/dr118.cpp
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 "
5
6// dr118: yes
7
8struct S {
9  virtual void f();
10};
11void (S::*pmf)();
12
13// CHECK-LABEL: define {{.*}} @_Z1g
14void 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
25}
26
27