This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/1822: math function conflicts



>Number:         1822
>Category:       libstdc++
>Synopsis:       math function conflicts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 31 11:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        2.97 20010129 (experimental)
>Organization:
>Environment:
System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix
>Description:


For the following source

-------------------------------------------------
#include <cmath>
#include <math.h>

double mag(double x) { return sqrt(x); }

using std::sqrt;
-------------------------------------------------

gcc gives the error

$ g++ -c y.cc
y.cc:6: `double std::sqrt(double)' conflicts with used function
/usr/include/bits/mathcalls.h:146: `double sqrt(double)' previously declared 
   here

Oddly, this error goes away if the definition of the mag() function
is removed.  It also goes away if we use `std::sqrt' instead of `sqrt'
in the body of mag().




>How-To-Repeat:
  See above.
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]