Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin_Z_1
Beginner
95 Views

C++ Compiler 15.0, type deduction issue

The following Example code produces the compiler error "c:/temp/test.cpp(15): error: no instance of function template "f2" matches the argument list" using command line "icpc.exe -std=c++11 c:\temp\test.cpp".

template <typename T, typename U>
auto f1(U const& u) -> decltype(T())
{
    return (T()+1.1) * u;
}

template <typename T, typename U>
auto f2(U const& u) -> decltype(f1<T>(u))
{
    return f1<T>(u);
}

int main()
{
    auto dummy = f2<double>(2);
    return 0;
}

 

It compiles if we add template parameter U to specifiy f1 more precise.

auto f2(U const& u) -> decltype(f1<T>(u))

by

auto f2(U const& u) -> decltype(f1<T, U>(u))

while we can retain the line that makes the call (not adding U to the f1 explicite template params list)

return f1<T>(u);

 

Is this a bug? Thank you for clarification in advance.

 

Unfortunately, like http://software.intel.com/en-us/forums/topic/530399 states we cannot try the N3638 feature decltype(auto) instead.

0 Kudos
4 Replies
QIAOMIN_Q_
New Contributor I
95 Views

Hello Martin,

What's your specific Intel compiler version and Visual studio version? Let me try to reproduce the problem first.

 

 

Thank you.
--
QIAOMIN.Q
Intel Developer Support
Please participate in our redesigned community support web site:

User forums:                   http://software.intel.com/en-us/forums/

Martin_Z_1
Beginner
95 Views

Hello QIAOMIN.Q,

well, I'll try to answer:

>...specific Intel compiler version...

As the TOPIC title says we are using version 15.0. Still more specific? Unfortunately "...Composer XE 2015\bin\intel64_mic\Icpc.exe" itself has no embedded file version information. (Accompanying icc.exe in the same folder is version 15.0.0.0).

>...specific ... Visual studio version...

As DESCRIBED we are using icpc.exe from the command line. Without Visual Studio. (Apart from that: We would like to get rid of the MSVC++ compiler. It is unusable from VS2013 Update 2 and completely broken with VS2013 Update 3.)

If I didn't understood you right, please tell me what information you exactly need. Or please tell me if this command line works on your machine.

Best regards, Martin

Martin_Z_1
Beginner
95 Views

Because "intel64\icl.exe" (which has the same reported issue) is more relevant for us at the moment I would like to demonstrate the configuration/procedure for this compiler version:
1) Open a standard cmd-Window (not a Visual Studio command prompt or anything like this).
2) C:\Program Files (x86)\Intel\Composer XE 2015\bin>iclvars.bat intel64 vs2013
3) C:\Program Files (x86)\Intel\Composer XE 2015\bin>intel64\icl.exe -Qstd=c++11 c:\temp\test.cpp

The compiler error is exactly the same as in my first post.

Version numbers:
The "intel64\icl.exe" reports "Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 20140726"
The "cl.exe" reports "Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64".

Thank you in advance.

QIAOMIN_Q_
New Contributor I
95 Views

Hello Martin,

  I have reproduced as you said and will enter this issue into our problem-tracking database.Thank you for submitting the issue.I'll get this posted whenever I have an update from our development team.


Thank you.
--
QIAOMINQ.
Intel Developer Support

Reply