From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11003 invoked by alias); 21 Mar 2002 10:06:03 -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 10974 invoked by uid 71); 21 Mar 2002 10:06:01 -0000 Resent-Date: 21 Mar 2002 10:06:01 -0000 Resent-Message-ID: <20020321100601.10973.qmail@sources.redhat.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, Klaus.Kretschel@dlr.de Received:(qmail 6563 invoked from network); 21 Mar 2002 10:03:05 -0000 Received: from unknown (HELO darwin.af.op.dlr.de) (129.247.240.74) by sources.redhat.com with SMTP; 21 Mar 2002 10:03:05 -0000 Received: (from kkre@localhost) by darwin.af.op.dlr.de (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) id g2LA4QT03526; Thu, 21 Mar 2002 11:04:26 +0100 Message-Id:<200203211004.g2LA4QT03526@darwin.af.op.dlr.de> Date: Thu, 21 Mar 2002 02:06:00 -0000 From: Kretschel Klaus Reply-To: Klaus.Kretschel@dlr.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: c++/6023: Valid template code does not compile X-SW-Source: 2002-03/txt/msg00793.txt.bz2 List-Id: >Number: 6023 >Category: c++ >Synopsis: Valid template code does not compile >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu Mar 21 02:06:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Klaus Kretschel >Release: 3.0.4 >Organization: DLR >Environment: System: Linux darwin 2.4.4-64GB-SMP #1 SMP Wed May 16 01:20:45 GMT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ./configure >Description: The call h->do_calc from Otto::calc in test program below gives the parse error temp_test.cc: In member function `T Otto::calc(VEC)': temp_test.cc:35: parse error before `;' token while the same syntax is correct when called from Hugo::calc. I cannot rule out that this might be covered by the missing feature "Two stage lookup in templates is not implemented" but I don't think so. Compiler call was "g++ -c -Wall temp_test.cc". >How-To-Repeat: Test program temp_test.ii (the "vektor" struct can as well be replaced by vector; it was only introduced to avoid lots of preprocessor output): # 1 "temp_test.cc" template struct vektor { V a; vektor(V v) : a(v) {} }; template struct Otto; template struct Hugo { template T calc(VEC x) { T tmp; tmp = this->do_calc(x); return tmp; } template T do_calc(const typename Otto::MyTraits::T2& x) { return x.a; } }; template struct Otto { template struct MyTraits; template struct MyTraits > { typedef vektor T2; }; template T calc(VEC x) { Hugo* h; T tmp; tmp = h->calc(x); tmp = h->do_calc(x); return tmp; } }; int main() { vektor c('X'); Otto otto; otto.calc(c); } >Fix: Have an intermediate method that calls method from inside class (like "Hugo::calc" in test program). Possible but very unsatifying because of redundant code. >Release-Note: >Audit-Trail: >Unformatted: