Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7783 Discussions

icpc fails to alert on an obvious compilation error in a call to std::copy

Yaniv_H_
Beginner
184 Views

The following simple code shows a strange behavior compiled by icpc:

#include <algorithm>
#include <complex>
#include <vector>

struct Float {
    float _f;
};

struct Float2 {
    float _f1;
    float _f2;
};

// using objType = float;               // Uncommenting this line will cause compilation to fail in line 22 (call to std::copy () in A::copyVect ())
// using objType = Float;               // Same for this line
// using objType = Float2;              // And for thils line too
using objType = std::complex<float>;    // For this line compilation succeeds though it should fail as well

class A {
public:
    void copyVect (std::vector<objType> &vectSrc) const {
        std::copy (vectSrc.begin (), vectSrc.end (), _vect.begin ());
    }

public:
    std::vector<objType> _vect;
};

int main()
{
    return 0;
}

Compilation was done using the command:

icpc-4.8 -std=c++11 stdcopy.cpp -o stdcopy

 

0 Kudos
1 Reply
MalReddy_Y_Intel
Employee
184 Views

Hi,

This issue is fixed in the latest icc 17.0.1 compiler. Please try with that.

#icpc -v
icpc version 17.0.1 (gcc version 4.8.5 compatibility)
 

Thanks,

Reddy

 

Reply