From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3141 invoked by alias); 21 Jan 2005 02:30:48 -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 2951 invoked by uid 48); 21 Jan 2005 02:30:37 -0000 Date: Fri, 21 Jan 2005 02:30:00 -0000 From: "andres_takach at mentor dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050121023036.19559.andres_takach@mentor.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19559] New: Compile error on template member function called from template function X-Bugzilla-Reason: CC X-SW-Source: 2005-01/txt/msg02950.txt.bz2 List-Id: Test file is only 30 lines (t5.cxx, the t5.ii is indentical and is included at the end. Comments explain the bug: template class mc_foo { int _d; public: mc_foo() {} mc_foo(int x) { _d = x; } mc_foo(const mc_foo &x) { _d = x._d; } template void f(int i) {} }; template void g( mc_foo val) { mc_foo<16> val2 = val; mc_foo val3 = val; // W3 == 16 in this example // the two following lines should be equivalent, but gcc3.4.3 is generating error // on val3.f<16>(0). It seems like val3 is not fully resolved and gcc then thinks // "<" is "less than" rather than the syntax for template val2.f<16>(0); // this works fine val3.f<16>(0); // this produces error "invalid use of member (did you forget the `&' ?)" } int main() { mc_foo<16> y(1); g(y); } ~/local/bin/c++ -v -save-temps t5.cxx Reading specs from /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/specs Configured with: ./configure Thread model: posix gcc version 3.4.3 /.automount/streak/root/scratch1/takach/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1plus -E -quiet -v -iprefix /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/ -D_GNU_SOURCE t5.cxx -mtune=pentiumpro -o t5.ii ignoring nonexistent directory "/.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i686-pc-linux-gnu/include" ignoring duplicate directory "/user/takach/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3" ignoring duplicate directory "/user/takach/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i686-pc-linux-gnu" ignoring duplicate directory "/user/takach/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/backward" ignoring nonexistent directory "NONE/include" ignoring duplicate directory "/user/takach/local/lib/gcc/i686-pc-linux-gnu/3.4.3/include" ignoring nonexistent directory "/user/takach/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3 /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i686-pc-linux-gnu /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/backward /.automount/streak/root/scratch1/takach/bin/../lib/gcc/i686-pc-linux-gnu/3.4.3/include /usr/local/include /usr/include End of search list. /.automount/streak/root/scratch1/takach/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1plus -fpreprocessed t5.ii -quiet -dumpbase t5.cxx -mtune=pentiumpro -auxbase t5 -version -o t5.s GNU C++ version 3.4.3 (i686-pc-linux-gnu) compiled by GNU C version 3.2.3 20030502 (Red Hat Linux 3.2.3-34). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 t5.cxx: In function `void g(mc_foo) [with int W3 = 16]': t5.cxx:29: instantiated from here t5.cxx:24: error: invalid use of member (did you forget the `&' ?) Contents of t5.ii # 1 "t5.cxx" # 1 "" # 1 "" # 1 "t5.cxx" template class mc_foo { int _d; public: mc_foo() {} mc_foo(int x) { _d = x; } mc_foo(const mc_foo &x) { _d = x._d; } template void f(int i) {} }; template void g( mc_foo val) { mc_foo<16> val2 = val; mc_foo val3 = val; val2.f<16>(0); val3.f<16>(0); } int main() { mc_foo<16> y(1); g(y); } -- Summary: Compile error on template member function called from template function Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: critical Priority: P1 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andres_takach at mentor dot com CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: 2.4.21-15.ELsmp #1 i686 i686 i386 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19559