<div dir="ltr">Hi Johnny:<div><br></div><div>Is this bug preventing you from compiling TAO with clang?</div><div><br></div><div>I don't have a fix, but was able to create a smaller test case -- perhaps it'll help someone figure out what's going on.</div><div><br></div><div><div><font face="monospace, monospace">#include <type_traits></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">namespace FOO {</font></div><div><font face="monospace, monospace">class T_base {};</font></div><div><font face="monospace, monospace">class A : public T_base {};</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">template <typename T> struct o_r;</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">template <typename T,</font></div><div><font face="monospace, monospace">          typename = typename std::enable_if<std::is_base_of<T_base, T>::value>></font></div><div><font face="monospace, monospace">o_r<T> make_f();</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">template <typename T> class o_r final {</font></div><div><font face="monospace, monospace">  template <typename _Tp1,</font></div><div><font face="monospace, monospace">            typename = std::enable_if<std::is_convertible<_Tp1 *, T *>::value>></font></div><div><font face="monospace, monospace">  explicit o_r(_Tp1 *) {}</font></div><div><font face="monospace, monospace">public:</font></div><div><font face="monospace, monospace">  template <typename _Tp1, typename NOT_INFERED> friend o_r<_Tp1> make_f();</font></div><div><font face="monospace, monospace">};</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">template <typename T, typename> o_r<T> make_f() { return o_r<T>(new T()); }</font></div><div><font face="monospace, monospace">} // namespace FOO</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">void foo() {</font></div><div><font face="monospace, monospace">#ifdef BAD</font></div><div><font face="monospace, monospace">  auto l1 = FOO::make_f<FOO::A>();</font></div><div><font face="monospace, monospace">  auto l2 = FOO::make_f<FOO::A>(); // << second one fails.</font></div><div><font face="monospace, monospace">#else</font></div><div><font face="monospace, monospace">  auto l1 = FOO::make_f<FOO::A>();</font></div><div><font face="monospace, monospace">  auto l2 = FOO::make_f<FOO::A, void>();</font></div><div><font face="monospace, monospace">#endif</font></div><div><font face="monospace, monospace">}</font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">local:/Users/dhinton/fail $ ../tools/3.9.0/Debug/bin/clang++ -std=c++11 -c f.cpp -DBAD</font></div><div><font face="monospace, monospace">f.cpp:27:13: error: no matching function for call to 'make_f'</font></div><div><font face="monospace, monospace">  auto l2 = FOO::make_f<FOO::A>(); // << second one fails.</font></div><div><font face="monospace, monospace">            ^~~~~~~~~~~~~~~~~~~</font></div><div><font face="monospace, monospace">f.cpp:18:67: note: candidate template ignored: couldn't infer template argument 'NOT_INFERED'</font></div><div><font face="monospace, monospace">  template <typename _Tp1, typename NOT_INFERED> friend o_r<_Tp1> make_f();</font></div><div><font face="monospace, monospace">                                                                  ^</font></div><div><font face="monospace, monospace">1 error generated.</font></div></div><div><br></div><div>hth...</div><div>don</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 24, 2017 at 12:18 PM, Johnny Willemsen via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Thanks for the confirmation. We also assumed it as something valid, the<br>
code does compile with Visual Studio 2015, gcc, and Intel C++ but we do<br>
know that that is not a guarantee that it is valid C++. Hopefully<br>
someone can pick this up soon and get this issue resolved.<br>
<br>
Thanks!<br>
<span class="HOEnZb"><font color="#888888"><br>
Johnny<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 02/24/2017 07:39 PM, John Brawn wrote:<br>
> This does look like a valid bug, and I've put a comment in the Bugzilla<br>
> ticket. It looks like something is going wrong with the handling of<br>
> default template arguments when instantiating friend template declarations,<br>
> though where exactly in clang the bug is originating I haven't a clue.<br>
><br>
> John<br>
><br>
>> -----Original Message-----<br>
>> From: cfe-dev [mailto:<a href="mailto:cfe-dev-bounces@lists.llvm.org">cfe-dev-bounces@lists.<wbr>llvm.org</a>] On Behalf Of<br>
>> Johnny Willemsen via cfe-dev<br>
>> Sent: 24 February 2017 15:27<br>
>> To: <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
>> Subject: [cfe-dev] Problem with C++11 template methods, friend, and<br>
>> namespaces<br>
>><br>
>> Hi,<br>
>><br>
>> We reported an issue when we combine template methods, friend, and<br>
>> namespace in 2014 and nothing happened with the report until now (see<br>
>> <a href="https://bugs.llvm.org//show_bug.cgi?id=20877" rel="noreferrer" target="_blank">https://bugs.llvm.org//show_<wbr>bug.cgi?id=20877</a>). Could maybe one of the<br>
>> developers confirm/deny that this is an issue or are we assuming some<br>
>> incorrect C++11 code?<br>
>><br>
>> Best regards,<br>
>><br>
>> Johnny Willemsen<br>
>> ______________________________<wbr>_________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>