This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45515] New: Unable to find base class constructor of templated base class
- From: "andareed at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Sep 2010 07:55:28 -0000
- Subject: [Bug c++/45515] New: Unable to find base class constructor of templated base class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code fails to compile:
template <class T>
class Foo {
public:
Foo(int i, int j) {}
};
class Bar : public Foo<int> {
Bar() : Foo(0, 0) {}
};
This produces the following output:
foo.cc: In constructor ?Bar::Bar()?:
foo.cc:8: error: class ?Bar? does not have any field named ?Foo?
foo.cc:8: error: no matching function for call to ?Foo<int>::Foo()?
foo.cc:4: note: candidates are: Foo<T>::Foo(int, int) [with T = int]
foo.cc:2: note: Foo<int>::Foo(const Foo<int>&)
If I change line 8 to "Bar() : Foo<int>(0, 0) {}" it compiles fine. The
original code also compiles fine with clang and comeau. Tested with head gcc,
4.3, and 4.4.
--
Summary: Unable to find base class constructor of templated base
class
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andareed at gmail dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45515