This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/18556] New: iostream header pollutes global namespace
- From: "demelier.david at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 18 Jun 2015 09:16:00 +0000
- Subject: [Bug libc/18556] New: iostream header pollutes global namespace
- Auto-submitted: auto-generated
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.