Opened 7 years ago
Closed 7 years ago
#755 closed bug (fixed)
Error building with GCC 6 (C++14)
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | minor | Milestone: | 4-1-0 and higher |
Component: | dontKnow | Version: | 4-0-3 |
Keywords: | Cc: |
Description
Fedora has started building with the upcoming GCC 6 compiler, which defaults to C++14 mode when building C++ code. It encounters an error while building Singular 4-0-3:
ppinitialReduction.cc: In function 'bool ppreduceInitially(sip_sideal*&, number, ideal, ring)': ppinitialReduction.cc:675:46: error: no matching function for call to 'make_pair(int&, int)' T.push_back(std::make_pair<int,int>(i,1)); ^ In file included from /usr/include/c++/6.0.0/bits/stl_algobase.h:64:0, from /usr/include/c++/6.0.0/vector:60, from ../../../gfanlib/gfanlib_vector.h:11, from ./tropicalStrategy.h:4, from ppinitialReduction.h:5, from ppinitialReduction.cc:5: /usr/include/c++/6.0.0/bits/stl_pair.h:406:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) make_pair(_T1&& __x, _T2&& __y) ^~~~~~~~~ /usr/include/c++/6.0.0/bits/stl_pair.h:406:5: note: template argument deduction/substitution failed: ppinitialReduction.cc:675:46: note: cannot convert 'i' (type 'int') to type 'int&&' T.push_back(std::make_pair<int,int>(i,1)); ^
The solution is to let the compiler deduce the types; i.e. change that line to this:
T.push_back(std::make_pair(i,1));
This should work for earlier versions of GCC as well. The point of make_pair is that you don't have to specify the types.
Note: See
TracTickets for help on using
tickets.
already fixed with 6828dc2a9db4f0616aef09df69cf620b2f3ace02