<div dir="ltr">On Tue, Sep 4, 2018 at 10:27 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><br><div><span class="gmail-"><br><blockquote type="cite"><div>On Aug 6, 2018, at 12:44 PM, Matt Miller via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="gmail-m_-9199129954614357265Apple-interchange-newline"><div><div>I was wondering if the following clang behavior is expected/standard compliant:<br><br>1. non-template friend function (not constructor): compiles in gcc and clang<br>2. non-template friend constructor: compiles in gcc and clang<br>3. template friend function (not constructor): compiles in gcc and clang<br>4. template friend constructor: compiles in gcc , but not clang<br>(compiled in clang 3.0.0 but not clang 3.1+)<br><br>Here is an example (use -DUSE_TEMPLATE to control whether the template<br>or non-template code is compiled):<br><br><a href="https://godbolt.org/g/FT7Mzj" target="_blank">https://godbolt.org/g/FT7Mzj</a><br><br>In the clang case for (4), it gives an error as if the friend<br>declaration was never made.<br><br>Looking at a C++ standard:<br><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf" target="_blank">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>n4659.pdf</a><br><br>It looks like section 14.3.5 gives an explicit example of a<br>non-template friend constructor being allowed.  In 17.5.4, it didn't<br>look like there was anything to indicate template friend constructors<br>are treated different than template friend non-constructor functions,<br>but maybe I'm missing a subtle point in that section or elsewhere.<br></div></div></blockquote><div><br></div></span>No, it looks like a bug to me.  Would you mind filing it?</div><div>  <a href="https://bugs.llvm.org" target="_blank">https://bugs.llvm.org</a></div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>John.</div></font></span></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Opened bug 38578:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://bugs.llvm.org/show_bug.cgi?id=38578">https://bugs.llvm.org/show_bug.cgi?id=38578</a></div><div class="gmail_extra"><br></div><div class="gmail_extra">-Matt<br></div></div>