mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 01:56:44 +00:00 
			
		
		
		
	When it->second.mPosition->mPrev != value.mPrev value is first moved into *mPosition and then used to get mPrev. Since mPrev is RefId and it's copy-only type there is no real problem but coverity complains about it. Also enforce contract of insertInfo to support move-only types by adding a test for a value type with deleted copy constructors.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			581 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			581 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include <components/esm3/infoorder.hpp>
 | 
						|
 | 
						|
#include <gtest/gtest.h>
 | 
						|
 | 
						|
namespace ESM
 | 
						|
{
 | 
						|
    namespace
 | 
						|
    {
 | 
						|
        struct Value
 | 
						|
        {
 | 
						|
            RefId mId;
 | 
						|
            RefId mPrev;
 | 
						|
 | 
						|
            Value() = default;
 | 
						|
            Value(const Value&) = delete;
 | 
						|
            Value(Value&&) = default;
 | 
						|
            Value& operator=(const Value&) = delete;
 | 
						|
            Value& operator=(Value&&) = default;
 | 
						|
        };
 | 
						|
 | 
						|
        TEST(Esm3InfoOrderTest, insertInfoShouldNotCopyValue)
 | 
						|
        {
 | 
						|
            InfoOrder<Value> order;
 | 
						|
            order.insertInfo(Value{}, false);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |