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

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

$
0
0

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

 

AttachmentSize
Downloadtext/x-c++srcstdcopy.cpp710 bytes

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>