This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error 980519 on egcs-2.91.66
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Internal compiler error 980519 on egcs-2.91.66
- From: KANEKO Tomoyuki <kaneko at graco dot c dot u-tokyo dot ac dot jp>
- Date: Wed, 21 Apr 1999 23:00:11 +0900
- cc: kaneko at graco dot c dot u-tokyo dot ac dot jp
I met an error arround template function instantiation across namespaces.
The following sample code results in "Internal compiler error 980519"
on "gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)",
with options "-Wall -g",
on machines of "FreeBSD 3.1-RELEASE" (x86) and
"SunOS 5.5.1 Generic_103640-17 sun4u sparc SUNW,Ultra-1."
Sorry if it has been fixed already.
I found "http://www.cygnus.com/ml/egcs-bugs/1998-Dec/0008.html" by
Altavista, but I do not know whether this problem is still open.
I will send intermediate ".ii" file later if needed.
Regards,
---
KANEKO Tomoyuki <kaneko@graco.c.u-tokyo.ac.jp>
// KAWAI Laboratory
// Graduate School of Arts and Sciences, The University of Tokyo, JAPAN
#include <iostream>
#include <vector>
namespace Model
{
int f();
template<class H> int f(H h);
template<class E>
struct Types
{
typedef vector<E> Tuple;
// typedef list<E> Tuple;
};
template<class E> Types<E>::Tuple * g();
} // namespace Model
int
Model::f()
{
return 3;
}
template<class H> int
Model::f(H h)
{
cout << h << endl;
return 0;
}
template<class E> Model::Types<E>::Tuple *
Model::g()
{
return new Types<E>::Tuple();
}
namespace Bridge
{
int f();
template<class H> int f(H h);
template<class E> Model::Types<E>::Tuple * g();
typedef Model::Types<char>::Tuple Tuple;
Tuple * g2();
template <class H> Tuple * g3(H h);
} // namespace Bridge
int
Bridge::f()
{
return Model::f();
}
template<class H> int
Bridge::f(H h)
{
return Model::f(h);
}
template<class E> Model::Types<E>::Tuple *
Bridge::g()
{
return Model::g<E>();
}
Bridge::Tuple *
Bridge::g2()
{
return Model::g<char>();
}
template <class H> Bridge::Tuple *
Bridge::g3(H h)
{
cout << h << endl;
return Model::g<char>();
}
main()
{
int i = Model::f(3); // ok
Model::Types<char>::Tuple * t = Model::g<char>(); // ok
// NG!!!
Model::Types<char>::Tuple * t2 = Bridge::g<char>();
Bridge::Tuple * t3 = Bridge::g2(); // ok
// NG!!!
Bridge::Tuple * t4 = Bridge::g3('c');
}