This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13744] New: ICE when using implicit copy constructor for struct defined in template function
- From: "thomharp at charter dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2004 17:39:01 -0000
- Subject: [Bug c++/13744] New: ICE when using implicit copy constructor for struct defined in template function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code fails with an ICE (errors are transcribed below). I haven't
found any structural changes I can make to this code without making the problem
go away, so I can't be sure what combination of constructs causes the problem,
but it's clear that this only happens when using the implicit copy constructor
for a type defined within a template function (or member function of a template
class) which derives from a base type with virtual functions supplied in the
newly defined type:
struct Base {
virtual Base *copy(void) = 0;
virtual ~Base() { }
};
template <typename T>
void make(void) {
struct Test : public Base {
Base *copy(void) {
return new Test(*this);
}
};
new Test();
}
int main(void) {
make<double>();
return 0;
}
compiling this with 'c++ main.cpp' gives the following errors:
main.cpp: In member function `Base* make()::Test::copy() [with T = double]':
main.cpp:13: instantiated from here
main.cpp:10: Internal compiler error in find_function_data, at function.c:310
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
thom@rudicles functor $
Also known to fail on gcc-3.2.3
--
Summary: ICE when using implicit copy constructor for struct
defined in template function
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thomharp at charter dot net
CC: gcc-bugs at gcc dot gnu dot org,thomharp at charter dot
net
GCC host triplet: gentoo linux, kernel 2.4.20, athlon k6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13744