GCC Bugreport

Eijck, Ronald van eijckronATiquip.nl
Tue Sep 14 01:46:00 GMT 1999


Hi, 

I think I've found a bug in GCC 2.95.1 (and previouse versions aswell) 
The following code does not compile. 

------8<------- 

#include <stdio.h> 
template <class T> class TestBase
{
	public:
		T const &Value(void) { return(value); }
		virtual void Value(T val) = 0;
	protected:
		T value;
}; 

class Test : public TestBase<int>
{
	public:
		void Value(int val) { value = val; }
}; 

void main(int argc, char **argv)
{
	Test test;

	test.Value(10); 
	printf("Value = %d\n", test.Value()); 
}

------8<------- 

gcc bugtest.cpp reports the following: 

bugtest.cpp: In function `int main(...)':
bugtest.cpp:25: no matching function for call to `Test::Value ()'
bugtest.cpp:16: candidates are: void Test::Value(int)

MS VisualC 6.0 compiles this correctly. If I change the function name
for Value() to AValue() GCC handles it correctly aswell. 

C'ya, 

	Ronald van Eijck





More information about the Gcc-bugs mailing list