From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27629 invoked by alias); 12 Nov 2001 22: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 27564 invoked by uid 71); 12 Nov 2001 22:16:01 -0000 Resent-Date: 12 Nov 2001 22:16:01 -0000 Resent-Message-ID: <20011112221601.27563.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, csk@cs.washington.edu Received:(qmail 20863 invoked by uid 61); 12 Nov 2001 22:06:44 -0000 Message-Id:<20011112220644.20862.qmail@sourceware.cygnus.com> Date: Thu, 01 Nov 2001 15:46:00 -0000 From: csk@cs.washington.edu Reply-To: csk@cs.washington.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: c++/4862: Parse error with templated member function X-SW-Source: 2001-11/txt/msg00019.txt.bz2 List-Id: >Number: 4862 >Category: c++ >Synopsis: Parse error with templated member function >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Mon Nov 12 14:16:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: csk@cs.washington.edu >Release: 3.0.2 >Organization: >Environment: Redhat 7.2, i686 >Description: The following code yields a parse error on the line "a.func();": ---------------------------- #include class A { public: template void func() { std::cout << T() << std::endl; } }; template void doit() { A a; a.func(); } int main( int argc, char ** argv ) { if( argc > 0 ) { doit(); } else { doit(); } } -------------------------------- Surely the definition of "doit" should be legal. On the other hand, if you erase the "doit" function from the code and replace "main" with this: ---------------------------------- int main( int argc, char ** argv ) { if( argc > 0 ) { A a; a.func(); } else { A a; a.func(); } } ---------------------------------------------- Everything compiles okay. This suggests to me that the first version of the code should be legal. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: