From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20635 invoked by alias); 29 Jun 2007 17:44:35 -0000 Received: (qmail 20612 invoked by uid 48); 29 Jun 2007 17:44:23 -0000 Date: Fri, 29 Jun 2007 17:44:00 -0000 Subject: [Bug c++/32549] New: Wrong template instance resolution among multiple object files. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "opichals at seznam dot cz" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-06/txt/msg02719.txt.bz2 There seems to be something inconsistent in the g++ template instantiation. When a template is instantiated with an argument of the same name in two object files in which the argument type is different (unlike their names). It appears that even though that those instances should have been distinct g++ resolves them into a single one which appears to be wrong. Please see the attached reproduction code. The code of the template only prints the sizeof() of its (template) argument. The argument if places in a global namespace in each of the object files is considered to be the same no matter of its size or structure (as long as it is of the same name). I have reproduced the gcc 3.4.6 and gcc 4.0.1 to behave the same in this aspect (see the attached test output files). -- Summary: Wrong template instance resolution among multiple object files. Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: opichals at seznam dot cz GCC build triplet: x86 GCC host triplet: x86 GCC target triplet: x86 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32549