public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/48406] New: <algorithm> #undefs isfinite() from math.h in C++0x mode
@ 2011-04-02  1:12 jyasskin at gcc dot gnu.org
  2011-04-02  5:52 ` [Bug libstdc++/48406] " jyasskin at gcc dot gnu.org
  2011-04-02 10:46 ` paolo.carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2011-04-02  1:12 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: <algorithm> #undefs isfinite() from math.h in C++0x
                    mode
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jyasskin@gcc.gnu.org


$ cat test.cc
#include <math.h>
#include <algorithm>

bool foo(double d) {
  return isfinite(d);
}
$ ~/opensource/gcc/git/install/bin/g++ -c test.cc 
$ ~/opensource/gcc/git/install/bin/g++ -c test.cc -std=gnu++0x
test.cc: In function ‘bool foo(double)’:
test.cc:5:20: error: ‘isfinite’ was not declared in this scope
test.cc:5:20: note: suggested alternative:
.../include/c++/4.7.0/cmath:528:21: note:   ‘std::isfinite’
$

This is a regression since gcc-4.4:

$ g++-4.4 -c test.cc -std=gnu++0x
$ 

It happens because <stl_algo.h> includes <random> in C++0x mode only, and
<random> includes <cmath>, which #undefs all the C99 math functions that
<math.h> defined, without 'using' the std functions back into the global
namespace.

As far as I can tell, [depr.c.headers] says that <math.h> puts the <cmath>
names into the global namespace, and it doesn't allow a later include of
<cmath> to take them back out. [depr.c.headers] also allows <cmath> to
unconditionally put its declarations and definitions into the global namespace,
which is what I'd propose as a fix.


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

* [Bug libstdc++/48406] <algorithm> #undefs isfinite() from math.h in C++0x mode
  2011-04-02  1:12 [Bug libstdc++/48406] New: <algorithm> #undefs isfinite() from math.h in C++0x mode jyasskin at gcc dot gnu.org
@ 2011-04-02  5:52 ` jyasskin at gcc dot gnu.org
  2011-04-02 10:46 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jyasskin at gcc dot gnu.org @ 2011-04-02  5:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2011-04-02 05:52:12 UTC ---
FWIW, the path from algorithm->cmath appears to have been introduced in
gcc-4.5.


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

* [Bug libstdc++/48406] <algorithm> #undefs isfinite() from math.h in C++0x mode
  2011-04-02  1:12 [Bug libstdc++/48406] New: <algorithm> #undefs isfinite() from math.h in C++0x mode jyasskin at gcc dot gnu.org
  2011-04-02  5:52 ` [Bug libstdc++/48406] " jyasskin at gcc dot gnu.org
@ 2011-04-02 10:46 ` paolo.carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-04-02 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-04-02 10:46:32 UTC ---
.

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


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

end of thread, other threads:[~2011-04-02 10:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-02  1:12 [Bug libstdc++/48406] New: <algorithm> #undefs isfinite() from math.h in C++0x mode jyasskin at gcc dot gnu.org
2011-04-02  5:52 ` [Bug libstdc++/48406] " jyasskin at gcc dot gnu.org
2011-04-02 10:46 ` paolo.carlini at oracle dot com

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).