diff --git a/test/C++Frontend/ptr-to-method-devirt.cpp b/test/C++Frontend/ptr-to-method-devirt.cpp new file mode 100644 index 00000000000..358b801af55 --- /dev/null +++ b/test/C++Frontend/ptr-to-method-devirt.cpp @@ -0,0 +1,14 @@ +// PR1602 +// RUN: %llvmgxx -c -emit-llvm %s -o - -O3 | llvm-dis | not grep ptrtoint +// RUN: %llvmgxx -c -emit-llvm %s -o - -O3 | llvm-dis | grep getelementptr | count 1 + + +struct S { virtual void f(); }; + +typedef void (S::*P)(void); + +const P p = &S::f; + +void g(S s) { + (s.*p)(); + }