This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/18556] New: iostream header pollutes global namespace


https://sourceware.org/bugzilla/show_bug.cgi?id=18556

            Bug ID: 18556
           Summary: iostream header pollutes global namespace
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: demelier.david at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

I'm unable to compile the following code that should just compile fine:

#include <iostream>

struct Version {
        int major;

        Version(int vmajor)
                : major(vmajor)
        {
        }
};

int main()
{
        return 0;
}

See the error:

In file included from /usr/include/i386-linux-gnu/sys/types.h:222:0,
                 from /usr/include/stdlib.h:314,
                 from /usr/include/c++/4.9/cstdlib:72,
                 from /usr/include/c++/4.9/ext/string_conversions.h:41,
                 from /usr/include/c++/4.9/bits/basic_string.h:2850,
                 from /usr/include/c++/4.9/string:52,
                 from /usr/include/c++/4.9/bits/locale_classes.h:40,
                 from /usr/include/c++/4.9/bits/ios_base.h:41,
                 from /usr/include/c++/4.9/ios:42,
                 from /usr/include/c++/4.9/ostream:38,
                 from /usr/include/c++/4.9/iostream:39,
                 from prog.cpp:1:
prog.cpp: In constructor 'Version::Version(int)':
prog.cpp:7:5: error: class 'Version' does not have any field named
'gnu_dev_major'
   : major(vmajor)

This happens because glibc authors added their own additions to the C++
standard which breaks it.

Fix (choose one):

a. Remove these stupid macros
b. Stop including your own header files in standard C++ headers

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]