From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16139 invoked by alias); 28 Feb 2003 11:06:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16119 invoked by uid 71); 28 Feb 2003 11:06:00 -0000 Resent-Date: 28 Feb 2003 11:06:00 -0000 Resent-Message-ID: <20030228110600.16118.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, steev@paradigmds.com Received: (qmail 15824 invoked by uid 48); 28 Feb 2003 11:03:07 -0000 Message-Id: <20030228110307.15823.qmail@sources.redhat.com> Date: Fri, 28 Feb 2003 11:06:00 -0000 From: steev@paradigmds.com Reply-To: steev@paradigmds.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9885: Typedef and namespace problem - scoping silently ignored X-SW-Source: 2003-02/txt/msg01477.txt.bz2 List-Id: >Number: 9885 >Category: c++ >Synopsis: Typedef and namespace problem - scoping silently ignored >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: accepts-illegal >Submitter-Id: net >Arrival-Date: Fri Feb 28 11:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Steev Wilcox >Release: g++ 3.2.1 >Organization: >Environment: i686-pc-linux-gnu >Description: I've reported this because I typed something that g++ didn't interpret in the way I (or anyone else here) expected, and I can't find any information on what really should happen. Please accept my apologies if you know about this already - I can't find it in your bug list, though. The following code doesn't do either of the two things that I believe would be sensible: namespace a {} typedef int a::b; I can't find in Stroustrup or on the web whether this is legal or not, but I reckon this code should either (i) work, ie define b in namespace a as an int, or (ii) complain that you can't do this, because you need to typedef b inside namespace a. I think option (ii), hence "accepts-illegal". What it actually does is silently ignore the "a::" in the typedef (even with -Wall), and typedef b globally to be an int without any warnings or errors, which doesn't seem right. Contrast this with the case when the typedef is instead a class definition. In this case, the compiler quite rightly gives an error that you can't define a::b outside of namespace a, but then defines b globally for the rest of the file before stopping. It might be that the error in the original typedef is being suppressed somehow, but the compiler carries on in the same way. Sorry again if this isn't actually a bug. Thanks for looking into it, Steev >How-To-Repeat: >Fix: Put the typedef in the namespace >Release-Note: >Audit-Trail: >Unformatted: