[PR #50] [bit_cost.h] fix "ambiguous call to overloaded function" (C2668) #641

Open
opened 2026-01-29 20:46:33 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/google/brotli/pull/50

State: closed
Merged: No


Hi,
after commit 534654def1, the encoder fails to compile on MS Visual Studio 2010, with the following error:

c:\userslocal\cosimo.lupo\documents\github\brotli\enc\./bit_cost.h(44) : error C2668: 'log' : ambiguous call to overloaded function
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(575): could be 'long double log(long double)'
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(527): or       'float log(float)'
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(120): or       'double log(double)'
    while trying to match the argument list '(int)'

At line 44 of "bit_cost.h", there is a call to log function: I think the varialbe sum should be cast to double.
Anyway, thanks for your work!

Cosimo

**Original Pull Request:** https://github.com/google/brotli/pull/50 **State:** closed **Merged:** No --- Hi, after commit 534654def1f7b858e6f24f895609e51e19a19580, the encoder fails to compile on MS Visual Studio 2010, with the following error: ``` c:\userslocal\cosimo.lupo\documents\github\brotli\enc\./bit_cost.h(44) : error C2668: 'log' : ambiguous call to overloaded function C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(575): could be 'long double log(long double)' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(527): or 'float log(float)' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\math.h(120): or 'double log(double)' while trying to match the argument list '(int)' ``` At line 44 of "bit_cost.h", there is a call to `log` function: I think the varialbe `sum` should be cast to double. Anyway, thanks for your work! Cosimo
claunia added the pull-request label 2026-01-29 20:46:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#641