diff --git a/src/libcalamares/utils/CommandList.h b/src/libcalamares/utils/CommandList.h index 17a251a7c..331127c1e 100644 --- a/src/libcalamares/utils/CommandList.h +++ b/src/libcalamares/utils/CommandList.h @@ -104,6 +104,8 @@ public: /** @brief empty command-list with timeout to apply to entries. */ CommandList( bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) ); CommandList( const QVariant& v, bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) ); + CommandList( int ) = delete; + CommandList( const QVariant&, int ) = delete; bool doChroot() const { return m_doChroot; } std::chrono::seconds defaultTimeout() const { return m_timeout; } diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 89dd45dfb..fd1411d38 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -364,8 +364,14 @@ commands: QCOMPARE( m[ "commands" ].toList().count(), 4 ); { - // Take care! The second parameter is a bool, so "3" here means "true" +#ifdef THIS_DOES_NOT_COMPILE_AND_THATS_THE_POINT + // Take care! The second parameter is a bool, so "3" here would + // mean "true", except the int overload is deleted to prevent just that. Calamares::CommandList cmds( m[ "commands" ], 3 ); + // .. and there's no conversion from std::chrono::duration to bool either. + Calamares::CommandList cmds( m[ "commands" ], std::chrono::seconds( 3 ) ); +#endif + Calamares::CommandList cmds( m[ "commands" ], true ); QCOMPARE( cmds.defaultTimeout(), std::chrono::seconds( 10 ) ); // But the 4 commands are there anyway QCOMPARE( cmds.count(), 4 );