Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ian_G_2
Beginner
88 Views

Template alias question/possible bug?

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

[cpp]#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;
}[/cpp]

Compiling this gives me the error:

[plain]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)[/plain]

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:

[plain]icpc --version
icpc (ICC) 14.0.0 20130728
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.[/plain]

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

 

Thanks in advance

- Ian Godtliebsen

0 Kudos
5 Replies
QIAOMIN_Q_
New Contributor I
88 Views

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.

Ian_G_2
Beginner
88 Views

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

QIAOMIN_Q_
New Contributor I
88 Views

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

QIAOMIN_Q_
New Contributor I
88 Views

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

QIAOMIN_Q_
New Contributor I
88 Views

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

Reply