Bug 49120 - C++ code including <complex> fails when using -pedantic due to hypot redeclaration.
Summary: C++ code including <complex> fails when using -pedantic due to hypot redeclar...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libstdc++
Version: 7.1
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-14 00:27 UTC by Mumit Khan
Modified: 2007-04-18 16:34 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-03-08 13:49:36 UTC
Embargoed:


Attachments (Terms of Use)
C++ <complex> hypot bug description, with preprocessed source. (46.17 KB, text/plain)
2001-07-14 00:28 UTC, Mumit Khan
no flags Details

Description Mumit Khan 2001-07-14 00:27:23 UTC
Bug details:
============

Even the most trivial C++ program that includes <complex> fails to compile
in combination with -pedantic due to conflicting declaration of hypot().

System and GCC RPM information
===============================
$ cat /etc/issue
Red Hat Linux release 7.1 (Seawolf)
Kernel 2.4.3-12 on an i686

[ All packages up-to-date as of 2001-07-12 using up2date ]

$ rpm -qa|grep gcc
gcc-objc-2.96-85
gcc-2.96-85
gcc-g77-2.96-85
gcc-c++-2.96-85
gcc-chill-2.96-85
gcc-java-2.96-85
$ rpm -qa|grep libstdc++
libstdc++-2.96-85
libstdc++-devel-2.96-85
 
Source
======
$ cat hypot-bug.cc
#include <complex>

 
Compiler invocation and error output
====================================
 
$ gcc -c -v -save-temps -pedantic hypot-bug.cc
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2
-D__EXCEPTIONS -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0
-D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__NO_INLINE__ -pedantic -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ hypot-bug.cc
hypot-bug.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (i386
Linux/ELF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus hypot-bug.ii -quiet
-dumpbase hypot-bug.cc -pedantic -version -o hypot-bug.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
(i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux
7.1 2.96-85).
In file included from /usr/include/g++-3/complex:7,
                 from hypot-bug.cc:1:
/usr/include/g++-3/std/complext.h:314: declaration of `double hypot
(double, double)' throws different exceptions
/usr/include/bits/mathcalls.h:150: than previous declaration `double
hypot (double, double) throw ()'

Comment 1 Mumit Khan 2001-07-14 00:28:45 UTC
Created attachment 23587 [details]
C++ <complex> hypot bug description, with preprocessed source.

Comment 2 Jakub Jelinek 2001-07-17 07:49:56 UTC
Will be fixed in libstdc++-devel-2.96-95 (is already in my tree).

Comment 3 Miloslav Trmac 2004-03-08 13:49:36 UTC
Fix confirmed in libstdc++-3.3.2-1.


Note You need to log in before you can comment on or make changes to this bug.