Skip to content

code cannot compile in Visual Studio 2015 #2

@quant911

Description

@quant911

Error msg:
1> Boost.Cpp11.2013.x64.vcxproj -> C:\dev\tapescript_vs2015\bin\vc120-x64-debug\libboost_unit_test_framework-vc120-mt-gd-1_57.lib
2>------ Rebuild All started: Project: Cl.Tape.Cpp11.2013.x64, Configuration: Debug x64 ------
3>------ Rebuild All started: Project: Cl.Tape.Examples.Cpp11.2013.x64, Configuration: Debug x64 ------
3> tape_other_translation_line.cpp
3> tape_example.cpp
3>c:\dev\tapescript_vs2015\tapescript\cpp\cl\tape\examples\impl\quadratic_regression_examples.hpp(209): error C2280: 'cl::tape_innercl::tape_array &cl::tape_innercl::tape_array::operator =(const cl::tape_innercl::tape_array &)': attempting to reference a deleted function
3> c:\dev\tapescript_vs2015\tapescript\cpp\cl\tape\impl\inner\tape_inner.hpp(289): note: compiler has generated 'cl::tape_innercl::tape_array::operator =' here
3> Generating Code...
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========

Reason: tape_inner has declared move constructor but not copy constructor. The source code above requires a copy constructor to compile.

In C++11 standard, a copy constructor should not be automatically generated if a move constructor is available. So above code should not compile. In this sense, VS2015 behaves correctly.

VS2013 is known not implementing such C++11 standard.

See links here:
https://msdn.microsoft.com/en-us/library/hh567368%28v=vs.120%29.aspx#rvref (on Rvalue references 3.0)
https://msdn.microsoft.com/en-ca/library/dn457344%28v=vs.120%29.aspx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions