public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19559] New: Compile error on template member function called from template function
@ 2005-01-21 2:30 andres_takach at mentor dot com
2005-01-21 2:34 ` [Bug c++/19559] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: andres_takach at mentor dot com @ 2005-01-21 2:30 UTC (permalink / raw)
To: gcc-bugs
Test file is only 30 lines (t5.cxx, the t5.ii is indentical and is included at
the end. Comments explain the bug:
template<int W>
class mc_foo {
int _d;
public:
mc_foo() {}
mc_foo(int x) { _d = x; }
mc_foo(const mc_foo &x) { _d = x._d; }
template<int W2>
void f(int i) {}
};
template <int W3>
void g( mc_foo<W3> val) {
mc_foo<16> val2 = val;
mc_foo<W3> 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<W3>) [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 "<built-in>"
# 1 "<command line>"
# 1 "t5.cxx"
template<int W>
class mc_foo {
int _d;
public:
mc_foo() {}
mc_foo(int x) { _d = x; }
mc_foo(const mc_foo &x) { _d = x._d; }
template<int W2>
void f(int i) {}
};
template <int W3>
void g( mc_foo<W3> val) {
mc_foo<16> val2 = val;
mc_foo<W3> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/19559] Compile error on template member function called from template function
2005-01-21 2:30 [Bug c++/19559] New: Compile error on template member function called from template function andres_takach at mentor dot com
@ 2005-01-21 2:34 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-21 2:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-21 02:34 -------
This is invalid and a dup of the bug which I just closed from you, see PR 19552.
*** This bug has been marked as a duplicate of 19552 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19559
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-21 2:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 2:30 [Bug c++/19559] New: Compile error on template member function called from template function andres_takach at mentor dot com
2005-01-21 2:34 ` [Bug c++/19559] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).