[cfe-dev] libc++ problem with clang trunk

İsmail Dönmez ismail at donmez.ws
Wed Nov 6 04:40:48 PST 2013


Hi,

Testcase stolen from #llvm channel, using clang r194134 on Linux x86-64.
This is also reported as http://llvm.org/bugs/show_bug.cgi?id=17826

[/havana/t/clang]> cat test.cpp
#include <memory>
using namespace std;

class test {
        struct private_tag {};
public:
        test(private_tag) {}
        static shared_ptr<test> make_test() {
                return make_shared<test>(private_tag());
        }
};

int main()
{
        auto t = test::make_test();
}


[/havana/t/clang]> clang++ -std=c++11 -stdlib=libc++  test.cpp
In file included from test.cpp:1:
In file included from /usr/include/c++/v1/memory:603:
/usr/include/c++/v1/tuple:267:11: error: rvalue reference to type
'test::private_tag' cannot bind to lvalue of type
      'test::private_tag'
        : value(__t.get())
          ^     ~~~~~~~~~
/usr/include/c++/v1/tuple:385:8: note: in instantiation of member function
'std::__1::__tuple_leaf<0, test::private_tag &&,
      false>::__tuple_leaf' requested here
struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
       ^
/usr/include/c++/v1/memory:4290:26: note: in instantiation of function
template specialization
      'std::__1::__shared_ptr_emplace<test, std::__1::allocator<test>
>::__shared_ptr_emplace<test::private_tag>' requested
      here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/usr/include/c++/v1/memory:4649:29: note: in instantiation of function
template specialization
      'std::__1::shared_ptr<test>::make_shared<test::private_tag>'
requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
                            ^
test.cpp:9:24: note: in instantiation of function template specialization
'std::__1::make_shared<test, test::private_tag>'
      requested here
                return make_shared<test>(private_tag());
                       ^
In file included from test.cpp:1:
In file included from /usr/include/c++/v1/memory:603:
/usr/include/c++/v1/tuple:268:10: error: static_assert failed "Can not copy
a tuple with rvalue reference member"
        {static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a
tuple with rvalue reference member");}
         ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131106/58259414/attachment.html>


More information about the cfe-dev mailing list