Verified Bug: Typename is not allowed

Verified Bug: Typename is not allowed

Bild des Benutzers Alex K.

There was a compiler bug when compiling a conflicting structure name:
https://bugzilla.mozilla.org/show_bug.cgi?id=784309

What this occurs with: Intel C++ Compiler 13 Beta 2

7 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers Alex K.

Just bumping this threads so any Intel developers can see it.

Bild des Benutzers Jennifer J. (Intel)

I think my version of Firefox is older. Could you create the .i from your env and attach here?

thanks,
Jennifer

Hi everybody,

Please take a look at isolated test-case for one error ( on a line 355 in a header provided by Alex ).
Unfortunately, some pieces of codes in the test-case are commented out because I decided to stop brining new components.
Every time when I was adding a new declaration it was needed some new dependent declaration(s).

I tested the test-case with 5 different C++ compilers and only two ( MSC & MinGW ) successfully compiled it.

template< typename IntegerType > struct IsSupportedPass2
{
	static const bool value = false;
};

template< typename IntegerType > struct IsSupported
{
	static const bool value = IsSupportedPass2< IntegerType >::value;
};

template< size_t Size, bool Signedness > struct StdintTypeForSizeAndSignedness
{};

template<> struct StdintTypeForSizeAndSignedness< 1, true >
{ typedef __int8   Type; };

template<> struct StdintTypeForSizeAndSignedness< 1, false >
{ typedef unsigned __int8  Type; };

template<> struct StdintTypeForSizeAndSignedness< 2, true >
{ typedef __int16  Type; };

template<> struct StdintTypeForSizeAndSignedness< 2, false >
{ typedef unsigned __int16 Type; };

template<> struct StdintTypeForSizeAndSignedness< 4, true >
{ typedef __int32  Type; };

template<> struct StdintTypeForSizeAndSignedness< 4, false >
{ typedef unsigned __int32 Type; };

template<> struct StdintTypeForSizeAndSignedness< 8, true >
{ typedef __int64  Type; };

template<> struct StdintTypeForSizeAndSignedness< 8, false >
{ typedef unsigned __int64 Type; };

template< typename IntegerType > struct IsSigned
{
	static const bool value = IntegerType(-1) <= IntegerType(0);
//	static const bool value = false;
//	static const bool value = true;
};

template< typename IntegerType, size_t Size = sizeof( IntegerType ) > struct TwiceBiggerType
{
	typedef typename StdintTypeForSizeAndSignedness<
						sizeof( IntegerType ) * 2,
						IsSigned< IntegerType >::value >::Type Type;
};

template< typename T,
		  bool IsSigned = IsSigned< T >::value,
		  bool TwiceBiggerTypeIsSupported =
		  IsSupported< typename TwiceBiggerType< T >::Type >::value > struct IsMulValidImpl{};

template< typename T, bool IsSigned > struct IsMulValidImpl< T, IsSigned, true >
{
	static bool run( T x, T y )
	{
	//	typedef typename TwiceBiggerType< T >::Type TwiceBiggerType;
	//	TwiceBiggerType product = TwiceBiggerType( x ) * TwiceBiggerType( y );
	//	return IsInRange< T >( product );
		return ( bool )true;
	}
};

template< typename T > struct IsMulValidImpl< T, true, false >
{
	static bool run( T x, T y )
	{
	//	const T max = MaxValue< T >::value;
	//	const T min = MinValue< T >::value;
	//
	//	if( x == 0 || y == 0 )
	//		return true;
	//
	//	if( x > 0 )
	//	{
	//		return y > 0 ? x <= max / y : y >= min / x;
	//	}
	//
	//	// If we reach this point, we know that x < 0
	//	return y > 0 ? x >= min / y : y >= max / x;
		return ( bool )true;
	}
};

template< typename T > struct IsMulValidImpl< T, false, false >
{
	static bool run( T x, T y )
	{
	//	return y == 0 || x <= MaxValue< T >::value / y;
		return ( bool )true;
	}
};

template< typename T > inline bool IsMulValid( T x, T y )
{
	return IsMulValidImpl< T >::run( x, y );
}

void main( void )
{
	IsSupportedPass2< __int32 > isp2;
	IsSupported< __int32 > is;

	StdintTypeForSizeAndSignedness< sizeof( __int32 ), true > stfsas;
	StdintTypeForSizeAndSignedness< 1, true > int8type;
	StdintTypeForSizeAndSignedness< 1, false > uint8type;
	StdintTypeForSizeAndSignedness< 2, true > int16type;
	StdintTypeForSizeAndSignedness< 2, false > uint16type;
	StdintTypeForSizeAndSignedness< 4, true > int32type;
	StdintTypeForSizeAndSignedness< 4, false > uint32type;
	StdintTypeForSizeAndSignedness< 8, true > int64type;
	StdintTypeForSizeAndSignedness< 8, false > uint64type;

	IsSigned< __int8 > isInt8;

	TwiceBiggerType< __int8, sizeof( __int8 ) > tbt;

	IsMulValidImpl< __int8, false, false > imviInt8;
	IsMulValidImpl< unsigned __int8, true, false > imviUInt8;
	IsMulValidImpl< __int16, false, false > imviInt16;
	IsMulValidImpl< unsigned __int16, true, false > imviUInt16;
}

Hi,

Quoting alexboy94Just bumping this threads so any Intel developers can see it.

Here are a couple of comments:

- There are ~10 compilation errors and I've spent ~1 hour to create an isolated test-case just for one error

- I can see that FireFox software developers are using latest C++ features of a GCC C++ compiler ( Is that correct? ) and
  that is why Intel C++ compiler fails to compile some sources ( I agree that this is not good )

- You need to isolate as many as possible compilation errors in test-cases and it will help Intel software developers
  to fix these errors ( You're working on that project for some time already and you have really interesting
  problems )

- I don't know if Intel C++ software developers will be able to look at the latest version of FireFox project ( It would be nice if they look )

Best regards,
Sergey

This bug has been fixed in our latest development version. You should expect to see a fix in the next update.

Here is a description of the problem/fix. Thank you for reporting it to us. The problem was with the IsSigned type being used in the default argument.for the nontype template parameter IsSigned.

Visibility of template parameter in its default argument

A template parameter was incorrectly being found by lookup when scanning
its default argument. Template parameters are now no longer visible
in their default arguments. An exception is made for type parameters
in Microsoft mode.

template struct A {
static const bool value = true;
};
template ::value> struct B {};

Thanks, Judith! It is always a good thing when a follow up on some issue / problem is made.

Melden Sie sich an, um einen Kommentar zu hinterlassen.