<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 11, 2010, at 3:03 AM, Enea Zaffanella wrote:</div><blockquote type="cite"><div>Douglas Gregor wrote:<font class="Apple-style-span" color="#006312"><br></font><blockquote type="cite">g++ is too permissive. This is two-phase name lookup, which Clang is very strict about.<br></blockquote><font class="Apple-style-span" color="#006312"><br></font>Is there any plan to increase compatibility with g++ by adding some sort <br>of "relaxed mode" option?<br></div></blockquote><div><br></div>No. It's certainly technically possible, but it's not a priority for the project, assuming we even want to do it.</div><div><br></div><div>The fear is that if we add a relaxed mode switch, everyone will just add -frelaxed-mode or whatever and nobody will get the advantage of all these wonderful diagnostics we can emit in template definitions. :)</div><div><br></div><div><blockquote type="cite"><div>I checked clang source for a reference to the standard and I found the <br>following (Sema/SemaTemplate.cpp):<br><br> // C++0x [temp.expl.spec]p17:<br> // A member or a member template may be nested within many<br> // enclosing class templates. In an explicit specialization for<br> // such a member, the member declaration shall be preceded by a<br> // template<> for each enclosing class template that is<br> // explicitly specialized.<br> // We interpret this as forbidding typedefs of template<br> // specializations in the scope specifiers of out-of-line decls.<br><br>Both g++ and Comeau will refuse the example above if the "template <>" <br>was omitted ... but I don't see a strong relation between this behavior <br>and the presence of a typedef name.<br></div></blockquote><div><br></div>Without the template<>, the compiler doesn't realize you're declaring</div><div>an explicit specialization. But the design of template parameters in the</div><div>language (and Doug can speak more to this) is that parameter clauses</div><div>are matched up with argument clauses in the declared name — that is,</div><div>you match angle brackets to angle brackets. Using a typedef screws</div><div>up this matching because it means that parts of the name without</div><div>angle-brackets are supposed to matched against.</div><div><br></div><div>That's why the language requires it. From a user-design point of view,</div><div>gcc's permissiveness on this goes a long way towards explaining why</div><div>nobody but language geeks understands how this matching is</div><div>supposed to work.</div><div><br></div><div>John.</div></body></html>