[Bug c++/81347] New: g++ confused by namespaces and friend classes
thomasanderson at google dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 6 22:43:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81347
Bug ID: 81347
Summary: g++ confused by namespaces and friend classes
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: thomasanderson at google dot com
Target Milestone: ---
Created attachment 41695
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41695&action=edit
Preprocessed test.cpp
Compile test.cpp below using libc++ headers:
-----test.cpp-----
#include <set>
class C {
std::set<int> s;
};
#include <map>
using std::map;
------------------
$ g++ -c test.cpp -nostdinc++ -isystem/path/to/libc++/trunk/include
g++ fails to compile and gives:
main.cpp:9:12: error: ‘map’ is already declared in this scope
using std::map;
I've attached a preprocessed output for convenience.
$ g++ -c test_preproc.cpp 2>/dev/null && echo pass || echo fail
fail
$ clang++ -c test_preproc.cpp 2>/dev/null && echo pass || echo fail
pass
More information about the Gcc-bugs
mailing list