Opened 11 years ago

Last modified 11 years ago

#6056 new Bugs

units/test_output: unqualified sqrt() fails to compile on SunCC/SunOS

Reported by: Fedor Sergeev <Fedor.Sergeev@…> Owned by: Matthias Schabel
Milestone: To Be Determined Component: units
Version: Boost 1.47.0 Severity: Problem
Keywords: SunCC Cc:

Description

Compiling Boost/units test_output on SunOS with SunCC:

] sunCC  -library=stlport4 -I../ ../libs/units/test/test_output.cpp
"../libs/units/test/test_output.cpp", line 242: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 242: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 336: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 336: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 384: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 384: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 393: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 393: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 394: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 394: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 395: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 395: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 396: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 396: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 397: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 397: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 413: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 413: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 414: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 414: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 415: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 415: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 416: Error: The function "pow" must have a prototype.
"../libs/units/test/test_output.cpp", line 416: Error: The function "pow" must have a prototype.
24 Error(s) detected.

The standard math header included here - <cmath> - does not inject math functions into the global namespace. The only standard way to use these functions (pow included) is via std:: namespace.

All the uses of pow should be converted to std::pow, otherwise compilers with strictly conforming standard headers (like SunCC) will not be able to compile.

std::pow works fine with all the compilers I tried (SunCC, g++).

(suggested patch attached)

Attachments (1)

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

Download all attachments as: .zip

Change History (2)

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

Doh... pilot error. Is there a way to change bug summary?

Should read: "unqualified POW() fails to compile on SunCC/SunOS"

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

Attachment: diffs added

patch for std::pow

Note: See TracTickets for help on using tickets.