Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Type deduction failure with a class template explicitly specialised with a user defined type

$
0
0

Type deduction failure with a class template explicitly specialised with a user defined type

Hi,

I am trying to recompile a simulation program using icl to take advantage or Intel's mkl library, however, I have discovered a potential bug with the icl compiler.

I have a class template which is explicitly specialised with a user defined type (a struct of parameters which will be different for different distributions).

I have attached a stripped down version of my code ('get_type.cpp') which reproduces the error.

I am using the 2017 icl compiler on Windows 7 SP1 x-64 and Visual Studio 2015 Update 3. I am launching icl via the 'Intel 64' command prompt short cut.

I am using the commands:

icl /EHsc /Wall /Qstd=c++14 /O3 get_type.cpp

The message I am getting is:

get_type.cpp
get_type.cpp(44): error: no suitable conversion function from "const Normal" to "double" exists
              nreps_ {nreps}, nobs_ {nobs}, ar_ {ar}, dist_ {dist}, results_ {}
                                                             ^

For reference, both clang++ and Microsoft compilers compile and generate the following output.

clang++:

What type is Normal?
6Normal

Now the class SimTest<Normal>...
Deducing types for the private members...

nreps is: y
nobs is: y
ar is: d
dist is: 6Normal
results is: St6vectorIdSaIdEE

Now the copy of class SimTest<Normal>...
Deducing types for the private members...

nreps is: y
nobs is: y
ar is: d
dist is: 6Normal
results is: St6vectorIdSaIdEE

Microsoft cl:

What type is Normal?
struct Normal

Now the class SimTest<Normal>...
Deducing types for the private members...

nreps is: unsigned __int64
nobs is: unsigned __int64
ar is: double
dist is: struct Normal
results is: class std::vector<double,class std::allocator<double> >

Now the copy of class SimTest<Normal>...
Deducing types for the private members...

nreps is: unsigned __int64
nobs is: unsigned __int64
ar is: double
dist is: struct Normal
results is: class std::vector<double,class std::allocator<double> >

Thanks,
Luke

 

 

AttachmentSize
Downloadtext/x-c++srcget_type.cpp3.72 KB

Thread Topic: 

Bug Report

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>