public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "shihjr at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug preprocessor/52566] New: #include in c++ namespace scope doesn't work properly Date: Mon, 12 Mar 2012 16:25:00 -0000 [thread overview] Message-ID: <bug-52566-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52566 Bug #: 52566 Summary: #include in c++ namespace scope doesn't work properly Classification: Unclassified Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassigned@gcc.gnu.org ReportedBy: shihjr@gmail.com # gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 3 source files: ns1.h ns2.h test.cpp --------------------------------------------------------- ns1.h: #pragma once class A { }; --------------------------------------------------------- ns2.h: #pragma once class A { }; --------------------------------------------------------- test.cpp: namespace NS1 { #include "ns1.h" } namespace NS2 { #include "ns2.h" } int main() { NS2::A a; return 0; } --------------------------------------------------------- # touch * // important step, let ns1.h and ns2.h have same modification time # gcc test.cpp test.cpp: In function 'int main()': test.cpp:11: error: 'A' is not a member of 'NS2' test.cpp:11: error: expected ';' before 'a' # gcc -c -E test.cpp # 1 "test.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "test.cpp" namespace NS1 { # 1 "ns1.h" 1 class A { }; # 4 "test.cpp" 2 } namespace NS2 { } int main() { NS2::A a; return 0; } ---------------------------------------------------- The NS2::A declaration isn't included in namespace NS2
next reply other threads:[~2012-03-12 16:25 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-12 16:25 shihjr at gmail dot com [this message] 2012-03-12 16:31 ` [Bug preprocessor/52566] " redi at gcc dot gnu.org 2012-03-12 17:10 ` jakub at gcc dot gnu.org 2012-03-14 10:48 ` redi at gcc dot gnu.org 2022-12-14 13:19 ` [Bug preprocessor/52566] #include with #pragma once and files' contents is the same pinskia at gcc dot gnu.org 2022-12-14 13:27 ` terra at gnome dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-52566-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).