2013-03-05 16:30:04 +08:00
|
|
|
// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - | FileCheck %s
|
2009-10-07 01:54:23 +08:00
|
|
|
|
|
|
|
// PR5021
|
2010-02-13 02:14:46 +08:00
|
|
|
namespace PR5021 {
|
|
|
|
|
2009-10-07 01:54:23 +08:00
|
|
|
struct A {
|
|
|
|
virtual void f(char);
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(A *a) {
|
2009-10-13 04:06:34 +08:00
|
|
|
// CHECK: call void %
|
2009-10-07 01:54:23 +08:00
|
|
|
a->f('c');
|
|
|
|
}
|
2009-12-19 10:13:41 +08:00
|
|
|
|
|
|
|
struct B : virtual A {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(B * b) {
|
|
|
|
b->f();
|
2010-02-13 02:14:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test1 {
|
|
|
|
struct A {
|
|
|
|
virtual ~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : A {
|
|
|
|
virtual ~B();
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(B *b) {
|
|
|
|
b->f();
|
|
|
|
}
|
|
|
|
}
|
2013-03-05 16:30:04 +08:00
|
|
|
|
|
|
|
namespace VirtualNoreturn {
|
|
|
|
struct A {
|
|
|
|
[[noreturn]] virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: @_ZN15VirtualNoreturn1f
|
|
|
|
void f(A *p) {
|
|
|
|
p->f();
|
|
|
|
// CHECK: call void %{{[^#]*$}}
|
|
|
|
// CHECK-NOT: unreachable
|
|
|
|
}
|
|
|
|
}
|