[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#216209: g++-3.3: template-method not found depending on type



Package: g++-3.3
Version: 1:3.3.2-0pre5.0.1
Severity: normal
Tags: sid

The following program consists of two classes, both with a
parametrized method. Depending on the parameter type g++ the
compilation fails or not...

-- snip --
class E1 {
public:
  template <class T>
  void print(T bla) { };
};

class E2 {
public:
  // same as above but with a reference
  template <class T>
  void print(T& bla) { };
};

void foo1() {
  E1 e;

  // works
  e.print("hurz");

  // works too
  e.print(23);
};

void foo2() {
  E2 e;

  // works
  e.print("hurz");

  // fails!
  e.print(23);
};

int main () {  
};
-- snip --

riff /tmp> g++ -Wall temptest1.cc
temptest1.cc: In function `void foo2()':
temptest1.cc:33: error: no matching function for call to
`E2::print(int)'
temptest1.cc:13: error: candidates are: void E2::print(T&) [with T =
int]
Exitcode 1
riff /tmp> g++ --version
g++ (GCC) 3.3.2 20031005 (Debian prerelease)
[...]

This behavoir is at least inconsistent and I believe it to be
buggy. However, the Intel Compiler fails on the same line, so maybe
it's a special case in the C++-specs?!

Cheers
   Thimo

-- System Information:
Debian Release: testing/unstable
Architecture: alpha
Kernel: Linux riff 2.4.22riff #1 Mo Sep 29 22:54:24 CEST 2003 alpha
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro

Versions of packages g++-3.3 depends on:
ii  gcc-3.3                1:3.3.2-0pre5.0.1 The GNU C compiler
ii  gcc-3.3-base           1:3.3.2-0pre5.0.1 The GNU Compiler Collection (base 
ii  libc6.1                2.3.2-8           GNU C Library: Shared libraries an
ii  libstdc++5-3.3-dev     1:3.3.2-0pre5.0.1 The GNU Standard C++ Library v3 (d

-- no debconf information




Reply to: