Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Verified Bug: Typename is not allowed

Alex_K_6
Beginner
694 Views
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
0 Kudos
6 Replies
Alex_K_6
Beginner
694 Views
Just bumping this threads so any Intel developers can see it.
0 Kudos
JenniferJ
Moderator
694 Views
I think my version of Firefox is older. Could you create the .i from your env and attach here?

thanks,
Jennifer
0 Kudos
SergeyKostrov
Valued Contributor II
693 Views

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.

[cpp]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;
}
[/cpp]
0 Kudos
SergeyKostrov
Valued Contributor II
693 Views
Hi,

Quoting alexboy94
Just 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

0 Kudos
Judith_W_Intel
Employee
693 Views
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 {};
0 Kudos
SergeyKostrov
Valued Contributor II
693 Views
Thanks, Judith! It is always a good thing when a follow up on some issue / problem is made.
0 Kudos
Reply