- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Passing a std::complex<float> constant to a function that takes a std::complex<double> argument receives the wrong real part inside the function. Passing a std::complex variable produces the expected result. Changing the function to accept a value rather than a const reference makes no difference.
#include <complex> #include <iostream> void f(const std::complex<double> &val) // or void f(std::complex<double> val) { std::cout << "In f1, val = " << val << std::endl; } int main() { f(std::complex<float>(1,2)); // Fails std::complex<float> b(1,2); f(b); // Works return 0; }
Produces the output:
In f1, val = (2,2)
In f1, val = (1,2)
This is with the Intel compiler 19.0.4.243. GCC and clang give the expected results.
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this issue. I've submitted a bug #CMPLRIL0-32033 to the compiler Developer.

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