]> granicus.if.org Git - clang/commit
C++ DR1611, 1658, 2180: implement "potentially constructed subobject" rules for speci...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 25 Feb 2017 23:53:05 +0000 (23:53 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 25 Feb 2017 23:53:05 +0000 (23:53 +0000)
commit3d1874e6a370a1330a1da81e1fe7761696e6aaa0
tree36ba15eb67e131b2d0e58c4ee3d6da35fb47c63d
parent1ffe33bbfb69e67820e57881cfbd946306a111b6
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296275 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
include/clang/AST/DeclCXX.h
lib/AST/ASTImporter.cpp
lib/AST/DeclCXX.cpp
lib/CodeGen/CGClass.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
test/CXX/drs/dr16xx.cpp
test/CXX/drs/dr21xx.cpp [new file with mode: 0644]
test/CodeGenCXX/constructors.cpp
test/CodeGenCXX/implicit-exception-spec.cpp [new file with mode: 0644]
test/SemaCXX/implicit-exception-spec.cpp