Summary: | [C++11] call of overloaded ‘isnan’ is ambiguous | ||
---|---|---|---|
Product: | gcc | Reporter: | Dilawar Singh <dilawar.s.rajput> |
Component: | libstdc++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | minor | CC: | burnus, daniel.kruegler, eugene.zelenko |
Priority: | P3 | ||
Version: | 4.8.0 | ||
Target Milestone: | --- | ||
URL: | https://gist.githubusercontent.com/dilawar/9343802/raw/0eeac3f0d745af607cf1aab880b315e255fa003e/gcc-bug-60407 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2014-03-04 00:00:00 |
Description
Dilawar Singh
2014-03-04 09:31:30 UTC
This sounds like you are including math.h and then later on cmath. I don't know if this is a valid thing to do. But I cannot reproduce it with what I thought it was, please provide the preprocessed source. It's perfectly valid to do that. Without a testcase we can't do anything, please read http://gcc.gnu.org/bugs/ g++ info can be found here http://pastebin.com/raw.php?i=dA05h3ku Hi, Added the *.ii file and g++ -v output. Since one file was large, links are given. (In reply to Dilawar Singh from comment #4) > g++ info can be found here > > http://pastebin.com/raw.php?i=dA05h3ku (In reply to Dilawar Singh from comment #5) > Added the *.ii file and g++ -v output. Since one file was large, links are > given. > > http://pastebin.com/raw.php?i=dA05h3ku The g++ output I found at your pastebin link, however, I do not see the .ii file. (Tobias, see the URL field) Reduced: #include <math.h> #include <cmath> using namespace std; int main() { double d = 1.0; return isnan(d); } isnan.cc: In function ‘int main()’: isnan.cc:9:17: error: call of overloaded ‘isnan(double&)’ is ambiguous return isnan(d); ^ isnan.cc:9:17: note: candidates are: In file included from /usr/include/features.h:364:0, from /usr/include/math.h:26, from isnan.cc:1: /usr/include/bits/mathcalls.h:234:1: note: int isnan(double) __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); ^ In file included from isnan.cc:2:0: /usr/include/c++/4.8.2/cmath:626:3: note: constexpr bool std::isnan(long double) isnan(long double __x) ^ /usr/include/c++/4.8.2/cmath:622:3: note: constexpr bool std::isnan(double) isnan(double __x) ^ /usr/include/c++/4.8.2/cmath:618:3: note: constexpr bool std::isnan(float) isnan(float __x) ^ (In reply to Dilawar Singh from comment #0) > In a large project, I get the following trace. This, however, compiled with > g++4.7.x. Flag -std=c++11 is enabled in both cases. Are you sure? I get the same result with GCC 4.7.4, but only with -std=c++11 The snippet I sent you (in url filed) is a part of large project which compiles fine on Ubuntu-server (gcc4.7.x, I am not sure about x). I will confirm it later once I login onto server again. Once I change `isnan` to `std::isnan` in my project, it compiles fine with my g++-4.8.1. Looks like a dup of PR 48891. (In reply to Marc Glisse from comment #10) > Looks like a dup of PR 48891. Yes. It is very similar to this. Fine with me if it is marked dup. I was mistaken about gcc version on server. It is default gcc comes with Ubuntu-Precice (gcc-4.6.3). Also -std=c++0x flag is not set with gcc-4.6.3. So in nutshell, compiles with gcc4.6.3 without -std=c++0x, but fails with gcc-4.8.0 with -std=c++0x. I mentioned -std=c++11 wrongly in first report. Same problem exists in 4.9.2. In my code combining <cmath> with <vector> (later includes os_defines.h then features.h and mathcalls.h) produce same effect. Let's deal with this under 48891 then *** This bug has been marked as a duplicate of bug 48891 *** |