<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jul 13, 2014 at 6:43 PM, Nikola Smiljanić <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br>
<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">Thanks for the input guys, I have two questions:<br>
<br>
1. MSDN states "__super can only appear within the body of a member function." and yet msvc accepts it in a number of places (data member declaration, typedef, etc.). Do we wan't to be bug for bug compatible with msvc as I see that as major pain?<br>
</blockquote><div><br></div><div>I'm OK with accepting it anywhere inside a class. I think their documentation is trying to warn the user that it won't work if you use it in a class template. Consider this behavior:</div>
<div><br></div><div><div>template <typename T> struct A : T { __super::InnerType m; };</div></div><div><br></div><div><div>t.cpp(1) : error C2791: illegal use of 'super': 'A<T>' does not have any base classes</div>
<div> t.cpp(1) : see reference to class template instantiation 'A<T>' being compiled</div></div><div><br></div><div>My guess is that MSVC tries to do token substitution on __super as early as possible. This breaks down when you have dependent base classes, because you can't look the name up inside the template parameter.</div>
<div><br></div><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">
2. I agree with Aaron that we should support the 'name found in multiple bases' scenario. In theory this is simple enough, but I don't know how hard it is to implement in practice. I guess this is a question for Richard, can I get ambiguous declarations from LookupResult (I see that this is possible) and do an overload resolution on them (this looks more difficult as I don't know how to access the call arguments)?</blockquote>
<div><br></div><div>I think we need to do some overload resolution. MSVC resolves __super to B in this case:</div><div><div>struct A { void foo(int); };</div><div>struct B { void foo(short); };</div><div>struct C : A, B {</div>
<div> void foo(short x) {</div><div> __super::foo(x);</div><div> }</div><div>};</div></div><div><br></div><div>And they error out if you s/short/int/.</div></div></div></div>