Bug 153283

Summary: Failure to build due to ambiguous use of pow with clang++/libc++
Product: WebKit Reporter: Armin K. <krejzi>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: mcatanzaro
Priority: P2    
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Build fix none

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.