Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call of overloaded 'fmax(double&, double&)' is ambiguous #8

Closed
svigerske opened this issue Feb 22, 2020 · 5 comments
Closed

call of overloaded 'fmax(double&, double&)' is ambiguous #8

svigerske opened this issue Feb 22, 2020 · 5 comments
Labels
bug Something isn't working libadolc major

Comments

@svigerske
Copy link
Member

Issue created by migration from Trac.

Original creator: lorenz

Original creation time: 2010-09-29 07:18:25

Assignee: @awalther1

Version:

When trying to compile this simple test file, the compiler stops with an "ambiguous call" error for fmax and fmin. The problem would probably occur with other overloaded functions too.

Source file:

#include <adolc/adolc.h>

int main(int, char **)
{
	double x = 3, y = 4;
	
	fmax(x, y);
	fmin(x, y);
	
	return 0;
}

Compiler call:

$ gcc -I../ADOL-C/include -L../ADOL-C/lib -ladolc fmax_test.cpp 

Error messages:

fmax_test.cpp: In function 'int main(int, char**)':
fmax_test.cpp:7: error: call of overloaded 'fmax(double&, double&)' is ambiguous
../ADOL-C/include/adolc/adouble.h:72: note: candidates are: double fmax(const double&, const double&)
/usr/include/bits/mathcalls.h:339: note:                 double fmax(double, double)
fmax_test.cpp:8: error: call of overloaded 'fmin(double&, double&)' is ambiguous
../ADOL-C/include/adolc/adouble.h:71: note: candidates are: double fmin(const double&, const double&)
/usr/include/bits/mathcalls.h:342: note:                 double fmin(double, double)

System:

  • gcc 4.4.3
  • ADOL-C 2.1.10
@svigerske svigerske added bug Something isn't working libadolc major labels Feb 22, 2020
@svigerske
Copy link
Member Author

Comment by lorenz created at 2010-09-29 07:25:20

What I forgot to mention:

  • OS: Ubuntu 10.04 (Linux 2.6.32-24-generic-pae)

@svigerske
Copy link
Member Author

Comment by @kkulshre created at 2010-10-01 12:54:12

We need to look into this for the long run and define these selectively for certain compilers, but for the short run you may use either one of the following two workarounds:

  1. use any one of -ansi or -std=c90 switches in your compiler commands. Then gcc does not define fmin and fmax of its own.
  2. remove the fmin(const double&, const double&) declaration and defintions from your copy of adouble.h

@svigerske
Copy link
Member Author

Comment by @kkulshre created at 2010-10-01 15:24:22

Please try using the svn trunk revision 169 of adolc

svn co https://projects.coin-or.org/svn/ADOL-C/trunk adolc_trunk

Your little program from above is also included as adolc_trunk/ADOL-C/tests/fminmax.cpp

Hopefully this will get rid of the problem in a portable way.

@svigerske
Copy link
Member Author

Comment by lorenz created at 2010-10-01 19:40:54

Okay, it's fixed in trunk, and the example compiles without any problems. Thank you.

@svigerske
Copy link
Member Author

Comment by @awalther1 created at 2010-10-07 09:26:06

Resolution: fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libadolc major
Projects
None yet
Development

No branches or pull requests

1 participant