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 ::
There is a dup of bug 6257. *** This bug has been marked as a duplicate of 6257 ***