public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Werth <alexander.werth@gmx.de>
To: gcc-help@gcc.gnu.org
Subject: namespace and class within with similar name
Date: Mon, 04 Aug 2008 23:03:00 -0000	[thread overview]
Message-ID: <1217890908.21247.17.camel@Jiminy> (raw)

Hi,

I have the following code and I wonder why C++ complains.

namespace S {

class L;
class S;

}

using namespace S;

class C {
    void m(::S::L *l) {};
};

$ g++ main.5.cpp
main.5.cpp:12: error: ‘struct S::S::L’ has not been declared

Shouldn't it be clear that I wan't to access class L in
namespace S and not some L of class S in namespace S ?

Couriously I only get this error on some compilers:
gcc 4.1 and gcc 4.2.3 produce this error while
gcc 3.2.2 and xlc work as expected.

Any idea besides complaining about why I want to do this at all ? ;)

Alexander



             reply	other threads:[~2008-08-04 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 23:03 Alexander Werth [this message]
2008-08-05 11:44 ` John Love-Jensen

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=1217890908.21247.17.camel@Jiminy \
    --to=alexander.werth@gmx.de \
    --cc=gcc-help@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: link
Be 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).