Template bug?
Knut Akesson
ka@s2.chalmers.se
Sun Sep 6 05:18:00 GMT 1998
Hi,
I might have found a bug in the egcs-1.1 compiler. I got this error
message :
> test.cpp: In method `class T<double>::A S<double,char>::foo<double, char>()':
> test.cpp:37: instantiated from here
> test.cpp:32: conversion from `T<char>' to non-scalar type `T<double>::A' requested
> test.cpp: In function `int main(...)':
> test.cpp:37: conversion from `T<double>::A' to non-scalar type `T<char>::A' requested
when I compiled the following code. The code compiles with both
egcs-1.0.3 and MSVC5, and is legal as far as I know.
template<class C>
class T {
public:
class A{};
operator A() const { return A(); }
};
template<class B, class C>
class S {
public:
T<C>::A foo() { return T<C>(); }
};
void main() {
S<double, char> s;
T<char>::A t = s.foo();
}
/Knut
________________________________________________________________
Knut ÃÂ
kesson +46 (0)31 772 3717 (work)
Department of Signals and System +46 (0)31 772 3730 (fax)
Control Engineering Laboratory +46 (0)31 27 48 26 (home)
Chalmers University of Technology
S-412 96 Gothenburg mailto:ka@s2.chalmers.se
Sweden http://www.control.chalmers.se/~ka
________________________________________________________________
More information about the Gcc-bugs
mailing list