- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Luke
Thank you for raising the issue with a reproducer.
I have reproduced the issue you reported and entered it in our problem tracking system. We will try to resolve this issue as soon as we can. However, please be advised that this issue may have to be targeted to for the next major release. I will let you know when I have an update on this issue.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Luke
There is a simple work-around: do not use the aggregate initialization syntax, i.e.:
Change this:
dist_ {dist},
to:
dist_ (dist)
Hope this helps. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Luke
In addition this new syntax: initialization list is not supported in GNU versions earlier than 5.0 or MSVC++ versions earlier than MSVC++ 2015.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yolanda,
Thank you. I did try this and discovered it worked. I understand, but if I specify /Qstd=c++14 then uniform initialisation is supposed to be supported. It was one of the main additions to C++11 to prevent narrowing.
Thank you again,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Luke
Yes, we have recorded the issue and is working on a resolution. I will let you know when I have an update on this issue.
Thank you for reporting the issue!
Thanks.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page