From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7509 invoked by alias); 5 Jan 2005 20:17:37 -0000 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 Received: (qmail 7395 invoked by uid 48); 5 Jan 2005 20:17:29 -0000 Date: Wed, 05 Jan 2005 20:17:00 -0000 From: "o dot kullmann at swansea dot ac dot uk" To: gcc-bugs@gcc.gnu.org Message-ID: <20050105201727.19279.o.kullmann@swansea.ac.uk> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19279] New: wrong code due to name import from the implementation of the standard library X-Bugzilla-Reason: CC X-SW-Source: 2005-01/txt/msg00523.txt.bz2 List-Id: For example with #include #include double close(double) { return 1239; } int main() { assert(close(10) == 1239); } which should run without asserting, actually the assert fails. The reason is that includes /usr/include/unistd.h which defines int close(int) and which is preferred over the above version of close. The above code is just a trivial example for wrong code produced by g++; in my code is was much harder to find the problem, and actually anything can happen with "close" and likely many other names included by the implementation of the standard library. I consider this bug as very serious (it can ruin any perfectly valid program). Of course, once you know the problem for this name, you can work around it, but then g++ is not a C++ compiler anymore, and how to know the critical names??? In the list of known bugs I couldn't find anything mentioned in the above direction, but it seems to me, that serious warnings must be posted. -- Summary: wrong code due to name import from the implementation of the standard library Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: o dot kullmann at swansea dot ac dot uk CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19279