[clang] Patch for 6037

Nathan Sidwell nathan at acm.org
Fri Dec 5 13:57:15 PST 2014


This (proto) patch addresses bug 6037 http://llvm.org/bugs/show_bug.cgi?id=6037
A request for a class definition to warn about inaccessible direct base classes. 
  I've  added a check in Sema::AttachBaseSpecifiers to iterate over the direct 
base array looking for ambiguous conversions to the individual bases.  The 
output is something like:

6037.cc:8:15: warning: direct base 'A' is inaccessible due to ambiguity:
     struct C -> struct B -> struct A
     struct C -> struct A
struct C : B, A {
               ^
which matches the form of error for an ambiguous base conversion itself.

This patch triggers on a pile of testcases, which I've not yet fixed, because 
I'd like some feedback on this approach first -- is there perhaps a better way 
to do this checking?

Also, as this is a warning, I presume there should be some way to disable it. 
How is that achieved in the clang framework?  (I'm not sure if the now failing 
tests should be fixed by disabling the warning, for instance).

nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6037.patch
Type: text/x-patch
Size: 2238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141205/836f0602/attachment.bin>


More information about the cfe-commits mailing list