Bug#185604: g++-3.2: method parametrized by template does not work everywhere
Package: g++-3.2
Version: 1:3.2.3-0pre5
Severity: important
The following program is valid C++, but does not compile:
-- snip --
class X {
public:
template<int d>
int bar () {return d;}
};
template<int x>
int fooo ()
{
return x;
}
template<class T>
void bar (T& g)
{
int kk = fooo<17>(); // OK
X x;
int k = x.bar<17>(); // Not OK
}
int main ()
{
X x;
int k=x.bar<17>(); // OK
int n;
bar(n);
}
-- snip --
aylee /tmp> g++ error.cc
error.cc: In function `void bar(T&) [with T = int]':
error.cc:26: instantiated from here
error.cc:18: no matching function for call to `X::bar()'
Exit 1
aylee /tmp> g++ --version
g++ (GCC) 3.2.3 20030309 (Debian prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Depending on whether the method-call is made in main() or inside a
template-function it works or not... The Intel Compiler compiles the
source.
Thimo
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux aylee 2.4.19 #2 Fre Nov 8 22:29:43 CET 2002 i686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro
Versions of packages g++-3.2 depends on:
ii gcc-3.2 1:3.2.3-0pre5 The GNU C compiler
ii gcc-3.2-base 1:3.2.3-0pre5 The GNU Compiler Collection (base
ii libc6 2.3.1-14 GNU C Library: Shared libraries an
ii libstdc++5-dev 1:3.2.3-0pre5 The GNU Standard C++ Library v3 (d
Reply to: