Add test for a deleted default constructor

This commit is contained in:
Peter Dimov
2017-10-29 18:31:41 +02:00
committed by Andrzej Krzemienski
parent 2d2c3c3f6f
commit 9e0726cee1
2 changed files with 41 additions and 0 deletions

View File

@ -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 ]
;
}

View 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