[Bug libstdc++/49762] New: symbols not kept in std namespace

domin144 at poczta dot onet.pl gcc-bugzilla@gcc.gnu.org
Sat Jul 16 12:17:00 GMT 2011


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

           Summary: symbols not kept in std namespace
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: domin144@poczta.onet.pl


Created attachment 24778
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24778
preprocessed file

When I include <cmath> library the 'omega' symbol gets to global namespace
making me unable to define my own global variable(or constant) of the same
name. What I expect is all the symbols from included standard libraries stay in
std namespace.

code (gamma_gcc.cpp):
#include <cmath>

const double gamma=0;

int main(int argc, char *argv[]) {
    return 0;
}

command:
g++ -v -save-temps gcc_gamma.cpp 2>log.txt

log.txt:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.1-1'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Debian 4.6.1-1) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/cc1plus -E -quiet -v
-D_GNU_SOURCE gcc_gamma.cpp -mtune=generic -march=x86-64 -fpch-preprocess -o
gcc_gamma.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/../../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.6
 /usr/include/c++/4.6/x86_64-linux-gnu
 /usr/include/c++/4.6/backward
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include
 /usr/local/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/cc1plus -fpreprocessed
gcc_gamma.ii -quiet -dumpbase gcc_gamma.cpp -mtune=generic -march=x86-64
-auxbase gcc_gamma -version -o gcc_gamma.s
GNU C++ (Debian 4.6.1-1) version 4.6.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.1-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Debian 4.6.1-1) version 4.6.1 (x86_64-linux-gnu)
    compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.1-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 0ad58bd6c0c247927e86db6007c69b16
gcc_gamma.cpp:3:14: error: ‘const double gamma’ redeclared as different kind of
symbol
/usr/include/bits/mathcalls.h:265:15: error: previous declaration of ‘double
gamma(double)’



More information about the Gcc-bugs mailing list