From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13997 invoked by alias); 27 Aug 2004 11:52:17 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 13984 invoked from network); 27 Aug 2004 11:52:10 -0000 Received: from unknown (HELO smtp1.uct.ac.za) (137.158.128.183) by sourceware.org with SMTP; 27 Aug 2004 11:52:10 -0000 Received: from anubis.uct.ac.za ([137.158.128.125]) by smtp1.uct.ac.za with esmtp (Exim 4.30; FreeBSD) id 1C0fH2-0000YN-AY for gcc-help@gcc.gnu.org; Fri, 27 Aug 2004 13:52:04 +0200 Received: from alice.phy.uct.ac.za ([137.158.37.151]) by anubis.uct.ac.za with esmtp (Exim 4.30; FreeBSD) id 1C0fH3-00084H-1F for gcc-help@gcc.gnu.org; Fri, 27 Aug 2004 13:52:05 +0200 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by alice.phy.uct.ac.za (8.12.8/8.12.8) with ESMTP id i7RBq3Rv004095 for ; Fri, 27 Aug 2004 13:52:03 +0200 From: Artur Szostak Reply-To: 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 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200408271352.03444.artur@alice.phy.uct.ac.za> X-SW-Source: 2004-08/txt/msg00253.txt.bz2 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