Comments (7)
Looks like this will need to wait for v2. For this testcase:
struct X { virtual ~X(); };
struct A : virtual X { A(); virtual void f() = 0; ~A(); };
struct Y : A { void f() {} } y;
... Clang emits a reference to _ZN1AD0Ev
and to _ZN1AD1Ev
when forming the construction vtable for A
in Y
, so ceasing to emit these symbols would break ABI in practice.
However, we can emit them as symbols with value 0 or something similar (that's what GCC puts in the construction vtable today). __cxa_pure_virtual
is almost a good fit here, but in practice the diagnostic it would produce for the case of, say,
A::A() { delete this; }
... doesn't really explain the problem.
from cxx-abi.
See also http://wg21.link/cwg1658, which means that it is no longer correct in general for emission of an abstract class's destructor to emit references to vbase destructors (for instance, a vbase destructor in a class template doesn't necessarily have a point of instantiation in the same translation unit).
from cxx-abi.
I agree with everything you have to say here. Tagging so that we can easily find this when we start adding v2-recommendation sections to the ABI.
from cxx-abi.
So... it turns out that this is valid:
struct B : A {};
void f(B *p) { p->A::~A(); }
... and ends up calling the complete object destructor for A
. But that seems like a language bug to me.
from cxx-abi.
It's also necessarily UB, right? So we're not actually obliged to implement it by calling the complete object destructor; we could just call the base constructor (or much worse, of course).
from cxx-abi.
It probably should be UB; I don't think the current language rules say that it is, but we should presumably fix that too :)
from cxx-abi.
Well, we can get started on implementing a runtime global dictionary of object kinds by address if the committee insists. :)
from cxx-abi.
Related Issues (20)
- "Deducing this" mangling HOT 14
- Should std::rethrow_exception be covered by the EH ABI? HOT 2
- Emergency EH buffer is overspecified HOT 6
- Where is the most recent ABI document? HOT 1
- Add `[[trivial_abi]]` attribute
- Lambda POD for the purposes of layout? HOT 2
- Mangling the name of an externally visible lambda in a static data member of a class HOT 1
- Proposal: Include an optional specification for mangling names that reference anonymous symbols HOT 4
- Is it possible to form a pointer-to-data-member with offset -1 using explicit derived-to-base conversions without UB? HOT 3
- unnecessary `E`s after <expression> and mangling collisions between <expression> and <number> HOT 1
- need mangling for lambdas appearing in unevaluated operands within a class body HOT 3
- What does "forbidding the use of function templates" mean? HOT 2
- [C++20] [Modules] Do we need the concept of `key function` for class defined in module purview? HOT 25
- Missing HTML encoding in 2.3.1 Data Member Pointers HOT 2
- Proposal: document or somehow notice __cxa_init_primary_exception HOT 3
- Mangling for C++ pack indexing HOT 1
- Function and function pointer types with vendor calling conventions HOT 2
- Ambiguity in mangling grammar around type qualifiers HOT 8
- Question about section 2.9.4 HOT 4
- Questions About Non-POD Types Data Layout HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cxx-abi.