[PATCH] D39389: [MS] Allow access to ambiguous, inaccessible direct bases

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 14:20:47 PDT 2017


rnk created this revision.

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.


https://reviews.llvm.org/D39389

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CodeGenCXX/microsoft-inaccessible-base.cpp
  clang/test/SemaCXX/accessible-base.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39389.120694.patch
Type: text/x-patch
Size: 7169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171027/38f4fa4a/attachment-0001.bin>


More information about the cfe-commits mailing list