<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 26, 2013, at 2:46 PM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:</div><blockquote type="cite"><div dir="ltr">On Tue, Mar 26, 2013 at 11:08 AM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
That is, change this:<br>
+ else if (usesMultipleInheritanceModel(MPT, RD))<br>
to<br>
+ else if (isFunc && usesMultipleInheritanceModel(MPT, RD))<br>
<br>
+ if (RD->getTypeForDecl()->isIncompleteType()) {<br>
<div class="im">+ if (Attr *IA = RD->getAttr<SingleInheritanceAttr>())<br>
+ Inheritance = IA->getKind();<br>
+ else if (Attr *IA = RD->getAttr<MultipleInheritanceAttr>())<br>
+ Inheritance = IA->getKind();<br>
+ else if (Attr *IA = RD->getAttr<VirtualInheritanceAttr>())<br>
+ Inheritance = IA->getKind();<br>
</div>+ else<br>
+ Inheritance = attr::UnspecifiedInheritance;<br>
+ } else {<br>
<br>
Check for the attribute first, and check for it with:<br>
if (Attr *IA = RD->getAttr<MSInheritanceAttr>()) {<br>
}<br></blockquote><div><br></div><div style="">Much better. :) There needs to be a diagnostic if we have multiple inheritance attrs, though.</div></div></div></div></blockquote><div><br></div><div>Yep.</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
That way you can e.g. implicitly add your UnspecifiedInheritanceAttr to a<br>
class decl and it'll just work. Also it means you don't have to enumerate your<br>
inheritance attribute kinds.<br>
<br>
+ // If template instantiation fails or the type is just incomplete, the ABI has<br>
+ // a poorly understood fallback mechanism in place, so we continue without any<br>
+ // diagnostics.<br>
+ if (Context.getTargetInfo().getCXXABI().isMicrosoft())<br>
+ RequireCompleteType(Loc, Class, 0);<br>
<br>
This would be an excellent opportunity to implicitly add your<br>
UnspecifiedInheritanceAttr to all the existing declarations. :)<br></blockquote><div><br></div><div style="">Is it OK if I just implicitly add the right attribute if there isn't one present already? I suppose the unspecified model is the only one that I need to add for correctness.</div></div></div></div></blockquote><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div style=""><br></div><div style="">It's actually important to lock this in at some point so we don't have different sizes at different TU points. In MSVC, if you declare a member pointer variable before the class definition, it uses the unspecified model. If you wait until after the definition, it will pick a more restrictive model.</div></div></div></div></blockquote><div><br></div>Yeah, I saw your comment to this effect earlier. I think adding UnspecifiedInheritanceAttr when you make a member pointer for a forward-declared class that lacks an explicit inheritance attribute makes sense. I wouldn't go down the road of adding, say, SingleInheritanceAttr to every class with single inheritance.</div><div><br></div><div>For sanity's sake, please add the attribute to all the existing declarations, though.</div><div><br></div><div>John.</div></body></html>