Opened 14 years ago
Last modified 5 years ago
#1974 reopened Bugs
ambiguous call to ref in vector_of_vector.hpp when using bind.hpp
Reported by: | Owned by: | Gunter | |
---|---|---|---|
Milestone: | To Be Determined | Component: | uBLAS |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | Cc: |
Description
When bind.hpp and numeric/ublas/vector_of_vector.hpp are both included, instantiating and using a generalized_vector_of_vector causes an ambiguous call to the overloaded function 'boost::numeric::ublas::ref'. See attached code for a simple example and attached patch for the simple proposed fix.
Attachments (3)
Change History (12)
by , 14 years ago
Attachment: | vector_of_vector.patch added |
---|
by , 14 years ago
Attachment: | ublas_bug.cpp added |
---|
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Milestone: | Boost 1.36.0 → To Be Determined |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
I close this issue because I did not get any comment on this and I cannot recreate it.
comment:3 by , 9 years ago
Hi there,
I can reproduce the error with Visual C++ 2012. Attached gvov.log is the VC++ error log for compiling the previously attached ublas_bug.cpp. The issue exists even without bind.hpp in ublas_bug.cpp. Note the same code actually compiles successfully with Visual C++ 2008, or recent g++.
Thanks, Steven
comment:4 by , 9 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Version: | Boost Development Trunk → Boost 1.54.0 |
comment:5 by , 8 years ago
I have this problem both on Windows with MSVC 2013 and on Mac with the default clang. Since the fix is trivial, I don't see why it shouldn't be implemented.
comment:6 by , 8 years ago
Version: | Boost 1.54.0 → Boost 1.56.0 |
---|
I'm using Boost 1.56 + MSVC2013. I also this problem, even without including bind.hpp. The patch vector_of_vector.patch works like a charm. Here is my test code:
#include "boost/numeric/ublas/matrix.hpp" #include "boost/numeric/ublas/matrix_sparse.hpp" #include "boost/numeric/ublas/vector_of_vector.hpp" int main(int argc, char** argv) { boost::numeric::ublas::generalized_vector_of_vector<double, boost::numeric::ublas::row_major, boost::numeric::ublas::vector<boost::numeric::ublas::compressed_vector<double> > > gvov(10, 10); gvov.clear(); return 0; }
My first compile error:
C:\Boost\include\boost-1_56\boost/numeric/ublas/vector_of_vector.hpp(326) : error C2668: 'boost::numeric::ublas::ref' : ambiguous call to overloaded function C:\Boost\include\boost-1_56\boost/numeric/ublas/vector_sparse.hpp(178): could be 'boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> &boost::numeric::ublas::ref<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>>(const VER &)' with [ T=size_t , VER=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> ] C:\Boost\include\boost-1_56\boost/numeric/ublas/vector_sparse.hpp(174): or 'boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> &boost::numeric::ublas::ref<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>>(VER &)' with [ T=size_t , VER=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> ] C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xrefwrap(697): or 'void std::ref<T>(const _Ty &&)' [found using argument-dependent lookup] with [ T=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> , _Ty=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> ] C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xrefwrap(691): or 'std::reference_wrapper<T> std::ref<T>(_Ty &) throw()' [found using argument-dependent lookup] with [ T=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> , _Ty=boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<size_t>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>> ] while trying to match the argument list '(boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>)' with [ T=size_t ] C:\Boost\include\boost-1_56\boost/numeric/ublas/vector_of_vector.hpp(322) : while compiling class template member function 'void boost::numeric::ublas::generalized_vector_of_vector<double,boost::numeric::ublas::row_major,boost::numeric::ublas::vector<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,boost::numeric::ublas::unbounded_array<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,std::allocator<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>>>>>::clear(void)' with [ T=size_t ] D:\test\main.cpp(10) : see reference to function template instantiation 'void boost::numeric::ublas::generalized_vector_of_vector<double,boost::numeric::ublas::row_major,boost::numeric::ublas::vector<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,boost::numeric::ublas::unbounded_array<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,std::allocator<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>>>>>::clear(void)' being compiled with [ T=size_t ] D:\test\main.cpp(9) : see reference to class template instantiation 'boost::numeric::ublas::generalized_vector_of_vector<double,boost::numeric::ublas::row_major,boost::numeric::ublas::vector<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<size_t,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,boost::numeric::ublas::unbounded_array<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>,std::allocator<boost::numeric::ublas::compressed_vector<double,0x00,boost::numeric::ublas::unbounded_array<T,std::allocator<T>>,boost::numeric::ublas::unbounded_array<double,std::allocator<double>>>>>>>' being compiled with [ T=size_t ]
comment:7 by , 7 years ago
Just a heads up: The bug is also present in 1.59 compiled with
$ gcc -v Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix
(the default "gcc" in MacOS X El Capitain).
The conflict here is again with a system library
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__functional_base_03:1115:1: note: candidate function [with _Tp = boost::numeric::ublas::mapped_vector<double, boost::numeric::ublas::map_std<unsigned long, double, std::__1::allocator<std::__1::pair<const unsigned long, double> > > >] ref(_Tp& __t)
The simple 8 year old patch applies flawlessly, and solves the problem.
comment:8 by , 6 years ago
Please implement this simple fix for this annoying problem. The same thing is flagged by g++ versions 4.8.5 and 5.3.0 on gnu/linux systems.
comment:9 by , 5 years ago
I can confirm that this bug exists on Windows using the latest ms compiler. I can also confirm that the provided patch DOES fix the issue. Any info on when this will be fixed?
Sorry, I cannot confirm this using g++ 4.1.2. Which compiler did you use?
Actually the correct ref() function should be found by Koenig-lookup.