public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/16668] New: ::sin(double) should be only std::sin(double)
@ 2004-07-22  7:59 tobias dot oberstein at gmx dot de
  2004-07-22  8:48 ` [Bug libstdc++/16668] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: tobias dot oberstein at gmx dot de @ 2004-07-22  7:59 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/16668] ::sin(double) should be only std::sin(double)
  2004-07-22  7:59 [Bug libstdc++/16668] New: ::sin(double) should be only std::sin(double) tobias dot oberstein at gmx dot de
@ 2004-07-22  8:48 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-22  8:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-22 08:48 -------
There is a dup of bug 6257.

*** This bug has been marked as a duplicate of 6257 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16668


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-22  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22  7:59 [Bug libstdc++/16668] New: ::sin(double) should be only std::sin(double) tobias dot oberstein at gmx dot de
2004-07-22  8:48 ` [Bug libstdc++/16668] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).