forked from boostorg/optional
Add test for a deleted default constructor
This commit is contained in:
committed by
Andrzej Krzemienski
parent
2d2c3c3f6f
commit
9e0726cee1
@ -73,5 +73,6 @@ import testing ;
|
||||
[ run-fail optional_xconfig_NO_PROPER_CONVERT_FROM_CONST_INT_fail.cpp ]
|
||||
[ run optional_xconfig_NO_LEGAL_CONVERT_FROM_REF_pass.cpp ]
|
||||
[ compile-fail optional_xconfig_NO_LEGAL_CONVERT_FROM_REF_fail.cpp ]
|
||||
[ compile optional_test_deleted_default_ctor.cpp ]
|
||||
;
|
||||
}
|
||||
|
40
test/optional_test_deleted_default_ctor.cpp
Normal file
40
test/optional_test_deleted_default_ctor.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2017 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
template<class T1, class T2> struct pair
|
||||
{
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair(): first(), second()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct A
|
||||
{
|
||||
A() = delete;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::optional< pair<A, int> > opt, opt2;
|
||||
opt = opt2;
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user