From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)
Description of problem:
I have created a template class that I then try to instantiate with an
enumeration (rather than a simple int/char or class) and I get an error in
the default constructor about converting an int to an enumeration.
class Test
{
public:
T first;
Test() : first()
{
}
};
enum DataType{DATE_TYPE=1, CHAR_TYPE=2};
int main(int argc, char *argv[])
{
DataType test; // Ok
Test<DataType> test3; // gives a warning
return 0;
}
How reproducible:
Always
Steps to Reproduce:
1. Compile the above program
2.
3.
Actual Results: I get an error on the template instantiation about
conversion from int to enum DataType.
Expected Results: This gives a warning in egcs-1.1.2.
Additional info:
I know this has increased from a warning to error in gcc 2.96, and I get
round it via -fenum-int-equiv or -fpermissive, but since it is an error I
guess I am doing something wrong. So
a) am I doing something wrong
b) how I should correct my code