2017-07-18 01:31:44 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++11 -o - -fcxx-exceptions -fexceptions | FileCheck %s
|
C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for special member functions.
Essentially, as a base class constructor does not construct virtual bases, such
a constructor for an abstract class does not need the corresponding base class
construction to be valid, and likewise for destructors.
This creates an awkward situation: clang will sometimes generate references to
the complete object and deleting destructors for an abstract class (it puts
them in the construction vtable for a derived class). But we can't generate a
"correct" version of these because we can't generate references to base class
constructors any more (if they're template specializations, say, we might not
have instantiated them and can't assume any other TU will emit a copy).
Fortunately, we don't need to, since no correct program can ever invoke them,
so instead emit symbols that just trap.
We should stop emitting references to these symbols, but still need to emit
definitions for compatibility.
llvm-svn: 296275
2017-02-26 07:53:05 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
A();
|
|
|
|
A(const A&);
|
|
|
|
A(A&&);
|
|
|
|
};
|
|
|
|
struct B : virtual A {
|
|
|
|
virtual void f() = 0;
|
|
|
|
};
|
|
|
|
struct C : B {
|
|
|
|
void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK-DAG: define {{.*}} @_ZN1BC2Ev({{.*}} #[[NOUNWIND:[0-9]*]]
|
|
|
|
C c1;
|
|
|
|
// CHECK-DAG: define {{.*}} @_ZN1BC2ERKS_({{.*}} #[[NOUNWIND]]
|
|
|
|
C c2(c1);
|
|
|
|
// CHECK-DAG: define {{.*}} @_ZN1BC2EOS_({{.*}} #[[NOUNWIND]]
|
|
|
|
C c3(static_cast<C&&>(c1));
|
|
|
|
|
|
|
|
// CHECK-DAG: #[[NOUNWIND]] = {{{.*}} nounwind
|