Opened 11 years ago

Closed 10 years ago

#6052 closed Bugs (fixed)

unqualified sqrt() fails with SunCC

Reported by: Fedor Sergeev <Fedor.Sergeev@…> Owned by: Lucanus Simonson
Milestone: To Be Determined Component: polygon
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

polygon/gtl_boost_unit_test fails to compile with SunCC

] sunCC -library=stlport4 -I. libs/polygon/test/gtl_boost_unit_test.cpp
...
"./boost/polygon/rectangle_concept.hpp", line 934: Error: The function "sqrt" must have a prototype.
"libs/polygon/test/gtl_boost_unit_test.cpp", line 794:     Where: While instantiating "boost::polygon::euclidean_distance<boost::polygon::rectangle_data<int>, boost::polygon::rectangle_data<int>>(const boost::
"libs/polygon/test/gtl_boost_unit_test.cpp", line 794:     Where: Instantiated from non-template code.
...
]

Polygon sources use quite a number of unqualified sqrt() calls. However the standard header they include - <cmath> - is not required to inject math functions into the global namespace. Thus the only standard way to use these functions (sqrt included) is via std:: namespace.

All the uses of sqrt should be converted to std::sqrt, otherwise compilers with strictly conforming STLs (like SunCC -stlport4) will not be able to compile.

(suggested patch attached)

Attachments (1)

diffs (3.7 KB ) - added by Fedor Sergeev <Fedor.Sergeev@…> 11 years ago.
patch for std::sqrt

Download all attachments as: .zip

Change History (3)

by Fedor Sergeev <Fedor.Sergeev@…>, 11 years ago

Attachment: diffs added

patch for std::sqrt

comment:1 by sydorchuk.andriy@…, 10 years ago

Will be fixed in Boost 1.52.

Andrii Sydorchuk

comment:2 by Lucanus Simonson, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.