public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Artur Szostak <artur@alice.phy.uct.ac.za>
To: gcc-help@gcc.gnu.org
Subject: using keyword problem
Date: Fri, 27 Aug 2004 12:18:00 -0000	[thread overview]
Message-ID: <200408271352.03444.artur@alice.phy.uct.ac.za> (raw)


Why does the following code not compile under GCC?
Is this not valid C++?

class A
{
public:
	struct S
	{
		int x;
	};
};

int Method()
{
	using A::S;

	S s;
	s.x = 1;
	return s.x;
};


When compiling the above code as is from source file main.cxx the following 
output is generated:

$ g++ main.cxx -o test
main.cxx: In function `int Method()':
main.cxx:12: parse error before `::' token
main.cxx:14: `S' undeclared (first use this function)
main.cxx:14: (Each undeclared identifier is reported only once for each
   function it appears in.)
main.cxx:15: `s' undeclared (first use this function)
$


-- 

Artur Szostak

Physics Department
University of Cape Town
Rondebosch
7701
South Africa

Work: +27 21 650 3356
Mobile: +27 82 297 9502
Email: artur@alice.phy.uct.ac.za   or  artursz@iafrica.com

             reply	other threads:[~2004-08-27 11:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-27 12:18 Artur Szostak [this message]
2004-08-27 15:03 ` Eljay Love-Jensen
2004-08-27 12:27 L.Suresh

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=200408271352.03444.artur@alice.phy.uct.ac.za \
    --to=artur@alice.phy.uct.ac.za \
    --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).