Bug 153283 - Failure to build due to ambiguous use of pow with clang++/libc++
Summary: Failure to build due to ambiguous use of pow with clang++/libc++
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-20 12:22 PST by Armin K.
Modified: 2016-01-20 12:25 PST (History)
1 user (show)

See Also:


Attachments
Build fix (413 bytes, patch)
2016-01-20 12:22 PST, Armin K.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Armin K. 2016-01-20 12:22:18 PST
Created attachment 269371 [details]
Build fix

When building with clang++/libc++ on Linux, the build fails with the following error:

[ 14%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/rendering/shapes/BoxShape.cpp.o
/home/armin/src/webkitgtk-2.10.5/Source/WebCore/rendering/shapes/BoxShape.cpp:46:40: error: call to 'pow' is ambiguous
        return radius + (margin * (1 + pow(ratio - 1, 3)));
                                       ^~~~~~~~
/usr/include/bits/mathcalls.h:153:17: note: candidate function
__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
                ^
/usr/bin/../include/c++/v1/math.h:869:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
                                             ^
/usr/bin/../include/c++/v1/math.h:870:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}



The problem is that both arguments passed to pow are integers and compiler can't decide whether to convert it to float, double or long double. It has to be explicitly converted. Attached patch works for me since floating point numbers will be treated as double by default in C++.
Comment 1 Michael Catanzaro 2016-01-20 12:25:59 PST
Thanks. Already fixed in r195011.