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

icc (ICC) 17.0.1 20161005 miscompiles C++11 code (related to move constructor ?)

$
0
0

Given test.cpp

#include <string>
#include <cassert>

class CPLString : public std::string
{
public:
    CPLString( const std::string &oStr ) : std::string( oStr ) {}
};

int main()
{
    CPLString osTest("test");
    CPLString osTest2( 0 ? std::string() + osTest : osTest );
    assert( !osTest.empty() );
}

$ icc -g -Wall -Wextra -std=c++11 test.cpp -o test && ./test
test: test.cpp:14: int main(): Assertion `!osTest.empty()' failed.

Whereas without -std=c++11 it doesn't assert.

On Ubuntu 16.04 64 bit. The same compiled with gcc 5.4 or clang 3.8 in C++11 doesn't assert.


Viewing all articles
Browse latest Browse all 1175

Trending Articles



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