This is an archive of the discontinued LLVM Phabricator instance.

MS ABI: Downgrade inheritance model mismatches to a warning sometimes
AcceptedPublic

Authored by majnemer on Jul 26 2014, 7:55 PM.

Details

Reviewers
rnk
rsmith
Summary

A polymorphic class with a single base class uses a multiple inheritance
model, not a single inheritance model. However, a pointer-to-member
field may appear before we know that there are any virtual methods.
We will, wrongly, assign the class a single-inheritance
pointer-to-member representation. Later on, we will check to see what
representation it actually got and issue a diagnostic.

Downgrade this diagnostic to a warning *if* the selection of inheritance
model is implicit.

This fixes PR20464.

tl;dr
A derived class, a base class, a virtual method and a pointer-to-member
walk into a bar. The pointer-to-member ruins the experience for
everyone.

Diff Detail

Event Timeline

majnemer updated this revision to Diff 11921.Jul 26 2014, 7:55 PM
majnemer retitled this revision from to MS ABI: Downgrade inheritance model mismatches to a warning sometimes.
majnemer updated this object.
majnemer added reviewers: rnk, rsmith.
majnemer added a subscriber: Unknown Object (MLST).

I implemented this for the sake of completeness, I don't think that we should actually fix this. This can be easily fixed in user code by making sure their virtual methods occur first in the class definition.

rnk edited edge metadata.Jul 29 2014, 3:42 PM

I think this is a good change if this is kept as an error instead of a warning.

majnemer updated this revision to Diff 13913.Sep 21 2014, 12:11 PM
majnemer edited edge metadata.
  • Address review comments
rnk accepted this revision.Oct 7 2014, 5:20 PM
rnk edited edge metadata.

lgtm

test/SemaCXX/member-pointer-ms.cpp
253

Maybe, namespace PR20464 since this isn't a warning any more?

This revision is now accepted and ready to land.Oct 7 2014, 5:20 PM

Looks like patch was not committed.