[LLVMbugs] [Bug 12704] New: build failed with libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 30 06:30:52 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12704

             Bug #: 12704
           Summary: build failed with libc++
           Product: new-bugs
           Version: 3.0
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sbn at tbricks.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code is failed to build when I use libc++ instead of libstdc++:

$ cat -n Any.cpp 
     1  #include <vector>
     2  
     3  class TypeA;
     4  class TypeB;
     5  
     6  class Any
     7  {
     8  public:
     9      Any();
    10  
    11      Any(const Any & src);
    12      ~Any();
    13  
    14  
    15      template <typename T>
    16      Any(const T & value)
    17      {
    18          set_value(value);
    19      }
    20  
    21      template <typename T>
    22      operator T () const;
    23  
    24  private:
    25      int set_value(const TypeA & value);
    26      int set_value(const TypeB & value);
    27  };
    28  
    29  void foo(std::vector<Any> & value)
    30  {
    31      value.resize(value.size() * 2);
    32  }
$ /usr/bin/clang++ -c Any.cpp 
$ /usr/bin/clang++ -stdlib=libc++ -c Any.cpp 
Any.cpp:18:9: error: no matching member function for call to 'set_value'
        set_value(value);
        ^~~~~~~~~
/usr/bin/../lib/c++/v1/type_traits:1358:12: note: in instantiation of function
template specialization 'Any::Any<std::__1::__rv<Any> >' requested here
    return _Tp(__rv<_Tp>(__t));
           ^
/usr/bin/../lib/c++/v1/utility:202:12: note: in instantiation of function
template specialization 'std::__1::move<Any>' requested here
    return _VSTD::move(__x);
           ^
/usr/bin/../lib/c++/v1/__config:174:15: note: instantiated from:
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/usr/bin/../lib/c++/v1/vector:737:24: note: in instantiation of function
template specialization 'std::__1::move_if_noexcept<Any>' requested here
        __v.push_front(_VSTD::move_if_noexcept(*--__p));
                       ^
/usr/bin/../lib/c++/v1/__config:174:15: note: instantiated from:
#define _VSTD std::_LIBCPP_NAMESPACE
              ^
/usr/bin/../lib/c++/v1/vector:897:9: note: in instantiation of member function
'std::__1::vector<Any, std::__1::allocator<Any> >::__swap_out_circular_buffer'
requested here
        __swap_out_circular_buffer(__v);
        ^
/usr/bin/../lib/c++/v1/vector:1678:15: note: in instantiation of member
function 'std::__1::vector<Any, std::__1::allocator<Any> >::__append' requested
here
        this->__append(__sz - __cs);
              ^
Any.cpp:31:11: note: in instantiation of member function 'std::__1::vector<Any,
std::__1::allocator<Any> >::resize' requested here
    value.resize(value.size() * 2);
          ^
Any.cpp:25:9: note: candidate function not viable: no known conversion from
'const std::__1::__rv<Any>' to 'const TypeA' for 1st argument
    int set_value(const TypeA & value);
        ^
Any.cpp:26:9: note: candidate function not viable: no known conversion from
'const std::__1::__rv<Any>' to 'const TypeB' for 1st argument
    int set_value(const TypeB & value);
        ^
1 error generated.

$ /usr/bin/clang++ -v
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list