Subject: CGAL users discussion list
List archive
- From: Martin Seemann <>
- To:
- Subject: [cgal-discuss] c++14 compatibility: CGAL::get and std::get ambiguity
- Date: Fri, 7 Aug 2015 11:58:20 +0200
- Organization: TU Dresden, Institut f. Automatisierungstechnik
Dear CGAL folks,
I recently came across a regression, which is demonstrated by the example below:
#include <CGAL/Simple_cartesian.h>
int main() {
typedef CGAL::Simple_cartesian<double> K;
CGAL::Line_3<K> line(CGAL::Point_3<K>(0, 0, 0), CGAL::Point_3<K>(1, 1, 1));
std::cout << line.point(0) << std::endl;
return 0;
}
Using GCC 5.2.0 (Archlinux), the above example compiles fine with -std=c++11 but when switching to -std=c++14, the compiler starts complaining about ambiguous 'get(...)' overloads in CGAL/Cartesian/Line_3.h:78.
I figured that it was caused by some c++14 additions to the standard library (http://en.cppreference.com/w/cpp/utility/pair/get, overloads 4-7).
A quick fix is to make the desired namespace explicit in CGAL/Cartesian/Line_3.h, i. e. to replace lines 78 and 83 by
return CGAL::get(base).first;
and
return CGAL::get(base).second;
respectively.
After these modifications, the above example (and also my real project) compiles fine.
However, prefixing with CGAL:: in this place seems strange to me, since we are already in namespace CGAL. Furthermore, I do not understand why the std::get variants even participate in overload resolution, given that they are defined in std (I couldn't find any dangerous
'using namespace std' anywhere in the CGAL code base either).
Maybe someone with a deeper understanding of the language can give his opinion if this situation should be corrected in CGAL or in the standard library.
BTW: The error also happens with clang (v3.6.2)
(My CGAL version is 4.6.2)
Greets,
Martin
- [cgal-discuss] c++14 compatibility: CGAL::get and std::get ambiguity, Martin Seemann, 08/07/2015
- Re: [cgal-discuss] c++14 compatibility: CGAL::get and std::get ambiguity, Marc Glisse, 08/11/2015
- Re: [cgal-discuss] c++14 compatibility: CGAL::get and std::get ambiguity, Martin Seemann, 08/11/2015
- Re: [cgal-discuss] c++14 compatibility: CGAL::get and std::get ambiguity, Marc Glisse, 08/11/2015
Archive powered by MHonArc 2.6.18.