From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29047 invoked by alias); 6 Feb 2006 20:06:43 -0000 Received: (qmail 29036 invoked by uid 48); 6 Feb 2006 20:06:40 -0000 Date: Mon, 06 Feb 2006 20:06:00 -0000 Message-ID: <20060206200640.29035.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/26110] using directive breaks ADL In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dg001 at t-online dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-02/txt/msg00553.txt.bz2 List-Id: ------- Comment #6 from dg001 at t-online dot de 2006-02-06 20:06 ------- Note, I didn't change the status of the bug yet. And you are absolutely right about the behavior of fundamental types. But I still encounter a problem with classes. Can you explain the behavior of gcc in the following example? --- BEGIN CODE --- namespace test { template double f(T1 f) { return 2.; } } class Type1 { public: Type1() {} ~Type1() {} }; double f(Type1 f) { return 1.; } int main(int argc, char *argv[]) { using test::f; Type1 d; double result1 = f(d); double result2 = test::f(d); return 0; } --- END CODE --- class Type1 and the function f are in the global namespace. Nevertheless "double result1 = f(d);" calls "template double f(T1 f)", which I think is wrong. The function "double f(Type1 f)" should be called instead. I tested this with another compiler (MS VC++ 8) and the code of this compiler calls the global function f in this case. Which behavior is the right one acording to the standard? If you now put "class Type1" and and "double f(Type1 f)" in their own namespace and change the code so it builds again, then gcc produces code, that calls the function "double f(Type1 f)" when executing the line "double result1 = f(d);". Is there anything wrong with the global namespace? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26110