From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16050 invoked by alias); 21 Apr 2003 20: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 16036 invoked by uid 71); 21 Apr 2003 20:06:00 -0000 Date: Mon, 21 Apr 2003 20:06:00 -0000 Message-ID: <20030421200600.16035.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/10437: "using namespace" at global scope creates incorrect code Reply-To: Wolfgang Bangerth X-SW-Source: 2003-04/txt/msg00904.txt.bz2 List-Id: The following reply was made to PR c++/10437; it has been noted by GNATS. From: Wolfgang Bangerth To: Dean Foster Cc: dean@foster.net, , Subject: Re: c++/10437: "using namespace" at global scope creates incorrect code Date: Mon, 21 Apr 2003 15:03:33 -0500 (CDT) > I'm willing to agree that that I've have an error/ambiguity in my > code. But I don't understand why bringing in a namespace that isn't > being called should change the ambiguity status. The point is that in order to find out which function the compiler shall take, it needs to know about the possibilities. For this, the possible declarations must "work". Without knowing your choices, you can't perform overload resolution. > In other words, > > main() > { > using namespace foo; > /* ... */ // no error > } > doesn't generate an error. But, the following does generate an error: > > using namespace foo; > main() > { > /* ... */ // generates error > } > > It seems that [they] should be the same. I guess that should be so. I can't reproduce this with the small example I posted. Can you try to come up with something short that shows this? Your original example was incredibly contrived, and I don't want to go through the ordeal again of reducing it, which took me well over an hour. Hint: try stripping template parameters, and replacing typedefs by the types the point to, etc. Once it's well below 100 lines I'll be willing to look at it again :-) W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/