This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/16668] New: ::sin(double) should be only std::sin(double)
- From: "tobias dot oberstein at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2004 07:59:43 -0000
- Subject: [Bug libstdc++/16668] New: ::sin(double) should be only std::sin(double)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
when including <cmath>, the standard says that in particular T sin (T) where T =
float, double or long double will go to namespace std. However, for T = double,
sin will go into :: and std::, which causes trouble for people who implement
their own sin at ::
to reproduce
------------
#include <iostream>
#include <cmath>
typedef float T; // OK.
//typedef double T; // PROBLEM!
//typedef long double T; // OK.
namespace foo
{
T sin (T x)
{
std::cout << "custom sin () called" << std::endl;
return (T) 0;
}
}
using namespace foo;
int main ()
{
sin ((T) 0);
return 0;
}
-------------
the root of problem i guess (from "cmath")
#include <math.h>
namespace std {
...
using ::sin;
inline float
sin(float __x)
{ return __builtin_sinf(__x); }
inline long double
sin(long double __x)
{ return __builtin_sinl(__x); }
...
}
-------------
"using ::sin;" drags ::sin into std, but doesn't remove it from ::
--
Summary: ::sin(double) should be only std::sin(double)
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot oberstein at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16668