Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Does the latest version support implicit move constructor and assignment?

Jayden_S_
Beginner
361 Views

 I am wondering if the latest intel C++ compiler in 2013 sp1 update 1 supports implicit move constructor and assignment. I tested it the following code

    #include <memory>

    #include <iostream>
    #include <algorithm>

    using namespace std;

    class A
    {
    public:
        unique_ptr<int> m;
    };

    int main()
    {
        A a;
        A b(std::move(a));
    }

Compile it on windows as

    icl main.cpp /Qstd=c++11

Errors

    main.cpp
    main.cpp(10): error #373: "std::unique_ptr<_Ty, _Dx>::unique_ptr(const
        std::unique_ptr<_Ty, _Dx>::_Myt &) [with _Ty=int, _Dx=std::default_delete<int>]"
        (declared at line 1447 of "C:\Program Files (x86)\Microsoft Visual Studio
        11.0\VC\include\memory") is inaccessible unique_ptr<int> m;
                                                                 ^
    detected during implicit generation of "A::A(const A &)" at line 16
    compilation aborted for main.cpp (code 2)

Basically the 2nd line in the main function `A b(std::move(a));` is looking for copy constructor `A::A(const A &)` other than move constructor `A::A(const A &&)`. That is usual when no implicit move constructors are generated. But the compiler said it support implicit move constructor. I am confused. Thanks.

0 Kudos
6 Replies
Raffael_C_
Beginner
361 Views

I just had a similar issue with the same version of the Intel compiler on windows and came to the same conclusion. Will Intel fix this in the next release?

0 Kudos
QIAOMIN_Q_
New Contributor I
361 Views

Have reprocuded as you said ,I will enter this into bug-tracking system and will get you posted on any progress on this .Thank you for your issue submission.

 

Thank you.
--
QIAOMIN.Q
Intel Developer Support
Please participate in our redesigned community support web site:

User forums:                   http://software.intel.com/en-us/forums/

0 Kudos
QIAOMIN_Q_
New Contributor I
361 Views

This will not be fixed since Mircosoft VS2013 doesn't support implicit move constructor yet.

We don't generate move constructors or assignment operators on Windows in order to be compatible with the MS compiler.

 

Thank you.
--
QIAOMIN.Q
Intel Developer Support

0 Kudos
shiftz
Beginner
361 Views

First of all, Microsoft's November 2013 CPT supports implicit move member generation.

Second, Intel could allow to enable it by setting up an extension flag.

0 Kudos
Judith_W_Intel
Employee
361 Views

 

These are supported under the hidden switch -Qoption,cpp,--gen_move_operations. I agree that Intel should enable this under the /Qstd=c++11 option. We don't support Microsoft CTPs so you will have to wait until the actual next MSVC++ studio release to complain about compatibility (:

I have entered DPD200255308 to track this defect. Thanks for reporting it.

Judy

0 Kudos
shiftz
Beginner
361 Views

Judith Ward (Intel) wrote:

These are supported under the hidden switch -Qoption,cpp,--gen_move_operations. I agree that Intel should enable this under the /Qstd=c++11 option. We don't support Microsoft CTPs so you will have to wait until the actual next MSVC++ studio release to complain about compatibility (:

 

I have entered DPD200255308 to track this defect. Thanks for reporting it.

 

Judy

That hidden switch changed my life! Is there another hidden switches? 

 

0 Kudos
Reply