[4.6.2] problem compiling templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody,

I noticed strange problem using gcc4.6.2, see please attached file.

Compiling this file I get:

In member function 'void Test<_enum>::foo()':
error: declaration of 'Predicate _enum'
error:  shadows template parm 'Enum _enum'

However it's enough to create intermediate object to avoid this problem (it also compiles ok with gcc3.4.3).

Am I doing wrong something here or this is known problem?

Regards,
Bogdan


enum Enum {
	Enum1
};

struct Predicate
{
	Predicate( Enum ) {}
};

template< typename TPredicate >
struct Filter
{
	Filter( TPredicate ) {}
};

template< Enum _enum >
struct Test
{
	void foo()
	{
		Filter< Predicate > filter( Predicate( _enum ) ); //error is here

		//this one compiles without any problem
		//Predicate predicate( _enum );
		//Filter< Predicate > filter( predicate );
	}
};

int main( int _argc, char ** _argv )
{
	Test< Enum1 > test;

	return 0;
}

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux