Template alias question/possible bug?

Template alias question/possible bug?

I tried compiling the following code with non-commercial icpc compiler:

#include<iostream>

	

	template<class T> struct test

	{

	   static const bool value = std::is_convertible<T,double>::value;

	};

	

	template<class T>                                                             // <-- if these two lines are commented out the code compiles

	using Request_double = typename std::enable_if<test<T>::value,void* >::type;  // <--

	

	//template<class T, Request_double<T> = nullptr >

	template<class T, typename std::enable_if<test<T>::value,void*>::type = nullptr >

	void func(T t)

	{

	   std::cout << t << std::endl;

	}

	

	//template<class T, class... U, Request_double<T> = nullptr >

	template<class T, class... U, typename std::enable_if<test<T>::value,void*>::type = nullptr >

	void func(T t, U... u)

	{

	   std::cout << t << " ";

	   func(u...);

	}

	

	int main()

	{

	   double a = 2.0, b = 3.0, c = 4.0;

	

	   func(a,b,c);

	

	   return 0;

	}

Compiling this gives me the error:

icpc -O3 -std=c++11 -o main main.cc

	main.cc(30): internal error: assertion failed: missing default rescan info (shared/cfe/edgcpfe/exprutil.c, line 4284)

	

	     func(a,b,c);

	     ^

	

	compilation aborted for main.cc (code 4)

This Code compiles fine on both GCC 4.7.3 and Clang 3.3. My question is if this is a bug or an unimplemented feature? and if so when it will be fixed/implemented? Commenting out the template alias "Request_double" also makes the code compile with icpc(?!).

The version of icpc I'm using is:

icpc --version

	icpc (ICC) 14.0.0 20130728

	Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

and I'm running it on an Ubuntu 13.04 machine.

 

Thanks in advance

- Ian Godtliebsen

6 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Build good with compiler 14.0 update1

$ icpc -V

Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008

 

Thanks,

QIAOMIN Q.

I'm now using:

$ icpc -V

Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Still gives the same error:

$ icpc -O3 -std=c++11 -o main main.cc
main.cc(30): internal error: assertion failed: missing default rescan info (shared/cfe/edgcpfe/exprutil.c, line 4291)

     func(a,b,c);
     ^

compilation aborted for main.cc (code 4)

- Ian

Thank you much for your test case. I've reproduced the problem you reported, and have entered it to our problem-tracking database. I'll let you know when I have an update from development team.

Thank you. -- QIAOMIN.Q

Intel Developer Support

This problem has been fixed in the upcoming next update of Compiler 14.0 ,which has been enhanced to strictly compare template parameters to make sure they aren't using the same constants.

Best,

QIao

This problem has been fixed in the upcoming next update of Compiler 14.0 ,which has been enhanced to strictly compare template parameters to make sure they aren't using the same constants.

Best,

QIao

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen