This is an archive of the discontinued LLVM Phabricator instance.

[MS] Allow access to ambiguous, inaccessible direct bases
ClosedPublic

Authored by rnk on Oct 27 2017, 2:20 PM.

Details

Summary

Clang typically warns that in the following class hierarchy, 'A' is
inaccessible because there is no series of casts that the user can
write to access it unambiguously:

struct A { };
struct B : A { };
struct C : A, B { };

MSVC allows the user to convert from C* to A*, though, and we've
encountered this issue in the latest Windows SDK headers.

This patch allows this conversion when -fms-compatibility is set and
adds a warning for it under -Wmicrosoft-inaccessible-base.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Oct 27 2017, 2:20 PM

When you say "latest Windows SDK headers", do you mean SDK version 10.0.16299.15?

rsmith accepted this revision.Oct 27 2017, 3:15 PM

Yuck, LGTM :)

This revision is now accepted and ready to land.Oct 27 2017, 3:15 PM
rnk added a comment.Oct 27 2017, 3:21 PM

When you say "latest Windows SDK headers", do you mean SDK version 10.0.16299.15?

Yep. Here's the bug about it in Chromium: https://crbug.com/775174

This revision was automatically updated to reflect the committed changes.