This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal compiler error: name confusion in template?
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Internal compiler error: name confusion in template?
- From: Ian Nixon <ian at tharas dot com>
- Date: Wed, 14 Jul 1999 14:21:26 -0700
Using:
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
The following code:
template <class Key> struct hash {
void operator()(Key c) const {}
};
template <class Key, class Functor>
class Hash {
public:
void Add (Key k) {
Functor f;
f.hash (k);
}
};
struct functor
{
void hash (const char *k) const {
::hash<const char *> hf;
hf (k);
}
};
main ()
{
Hash<const char *,functor> Table;
Table.Add ("Wibble");
}
produces this:
g++ code.cc -o code
code.cc: In method `void Hash<const char *,functor>::Add<const char *,
functor>(const char *)':
code.cc:30: instantiated from here
code.cc:12: Internal compiler error.
code.cc:12: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
code.cc:12: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for
details.
changing the name of one of the hash functions so there is no clash
removes
the problem.