<p dir="ltr">I went ahead and submitted a bug report. <a href="https://bugs.llvm.org/show_bug.cgi?id=33736">https://bugs.llvm.org/show_bug.cgi?id=33736</a></p>
<br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 11, 2017, 09:54 Joe Sylve <<a href="mailto:joe.sylve@gmail.com">joe.sylve@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">It is, but I'm not sure that libc++ is the cause or just points out the bug. If you look at the stack overflow link, you'll see an example of different code that triggers a similar error without the use of any library stuff. </p>
<br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 11, 2017, 03:45 Dimitry Andric <<a href="mailto:dimitry@andric.com" target="_blank">dimitry@andric.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>FYI, this looks like an issue in libc++.  If I compile your sample with the latest and greatest clang, but point it to the g++ 7.1.1 libstdc++ headers, it works just fine.</div><div><br></div><div>-Dimitry</div><br><div><blockquote type="cite"></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On 10 Jul 2017, at 20:55, Joe Sylve via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="m_2120446934994887173m_2357017954198006933Apple-interchange-newline"></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div><div dir="ltr"><div>I'm seeing an error that is similar to the question raised at <a href="https://stackoverflow.com/questions/43819314" target="_blank">https://stackoverflow.com/questions/43819314</a>.  That question seems to not have any consensus as to what the problem may be.  </div><div><br></div><div>I would appreciate if someone could shed some light on my issue and let me know if this is a known compiler bug or if clang is working as intended.</div><div><br></div><div>The following code produces a compile-time error in clang++ 4.0.0 and later, but works fine in gcc as well as previous versions of clang.</div><div><br></div><div>#include <memory></div><div><br></div><div>struct A {</div><div>    A() noexcept = default;</div><div>    A(const A&) noexcept = default;</div><div><br></div><div>    std::shared_ptr<int> _a {};</div><div>};</div><div><br></div><div>int main() {</div><div>    return 0;</div><div>}</div><div><br></div><div>It's worth noting that if I remove the copy constructor, this compiles fine.  If I remove the noexcept qualification from the default constructor it also compiles fine.</div><div><br></div><div>The error I'm getting is as follows:</div><div><br></div><div><source>:4:5: error: default member initializer for '_a' needed within definition of enclosing class 'A' outside of member functions</div><div>    A() noexcept = default;</div><div>    ^</div><div>/opt/compiler-explorer/clang-4.0.0/bin/../include/c++/v1/type_traits:1306:29: note: in instantiation of template class 'std::__1::is_class<int *>' requested here</div><div>template <class _Tp, bool = is_class<_Tp>::value></div><div>                            ^</div><div>/opt/compiler-explorer/clang-4.0.0/bin/../include/c++/v1/type_traits:1311:71: note: in instantiation of default argument for '__libcpp_abstract<int *>' required here</div><div>template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};</div><div>                                                                      ^~~~~~~~~~~~~~~~~~~~~~</div><div>/opt/compiler-explorer/clang-4.0.0/bin/../include/c++/v1/type_traits:1384:39: note: in instantiation of template class 'std::__1::is_abstract<int *>' requested here</div><div>                                     !is_abstract<_T2>::value> {};</div><div>                                      ^</div><div>/opt/compiler-explorer/clang-4.0.0/bin/../include/c++/v1/memory:3918:39: note: in instantiation of template class 'std::__1::is_convertible<int *, int *>' requested here</div><div>                   typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat())</div><div>                                      ^</div><div>/opt/compiler-explorer/clang-4.0.0/bin/../include/c++/v1/memory:3883:28: note: while substituting deduced template arguments into function template 'shared_ptr' [with _Yp = int]</div><div>class _LIBCPP_TEMPLATE_VIS shared_ptr</div><div>                           ^</div><div><source>:7:26: note: default member initializer declared here</div><div>    std::shared_ptr<int> _a {};</div></div></div></blockquote></div></div><div style="word-wrap:break-word"><div><blockquote type="cite"><div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br></div></blockquote></div><br></div></blockquote></div></blockquote></div>