From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30199 invoked by alias); 25 Sep 2002 23:16:02 -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 30169 invoked by uid 71); 25 Sep 2002 23:16:01 -0000 Resent-Date: 25 Sep 2002 23:16:01 -0000 Resent-Message-ID: <20020925231601.30167.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, marc@mit.edu Received: (qmail 29061 invoked by uid 61); 25 Sep 2002 23:12:29 -0000 Message-Id: <20020925231229.29060.qmail@sources.redhat.com> Date: Wed, 25 Sep 2002 16:16:00 -0000 From: marc@mit.edu Reply-To: marc@mit.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8050: g++ instantiates template too late X-SW-Source: 2002-09/txt/msg00693.txt.bz2 List-Id: >Number: 8050 >Category: c++ >Synopsis: g++ instantiates template too late >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Wed Sep 25 16:16:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Marc Horowitz >Release: unknown-1.0 >Organization: >Environment: gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) >Description: g++ gives an error on valid code. I believe the problem has to do with when templates are instantiated and available to the compiler, but it is difficult to be certain. I first observed this with the compiler listed in the Environment field above, but have confirmed it exists in 3.0.3 and 3.1. It does not exist in 2.95.3 or 2.95.4. I do not have access to 3.2, or any snapshots. >How-To-Repeat: Compile this code: template class X { public: operator T*() { return(0); } }; int* p; extern X xp; void foo() { p == xp; xp == p; p == xp; } with this command line: g++ -c foo.cc You will get this error: cfp.cc: In function `void foo ()': cfp.cc:14: no match for `int *& == X &' If you reorder the lines in foo() so that line 15 is first, the compiler does not complain anymore. >Fix: Unknown. >Release-Note: >Audit-Trail: >Unformatted: