From 9e0726cee145dad2263a5bbb62d66ae244b8cb70 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 29 Oct 2017 18:31:41 +0200 Subject: [PATCH] Add test for a deleted default constructor --- test/Jamfile.v2 | 1 + test/optional_test_deleted_default_ctor.cpp | 40 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/optional_test_deleted_default_ctor.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fd3c7e2..638012d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -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 ] ; } diff --git a/test/optional_test_deleted_default_ctor.cpp b/test/optional_test_deleted_default_ctor.cpp new file mode 100644 index 0000000..523908f --- /dev/null +++ b/test/optional_test_deleted_default_ctor.cpp @@ -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 + +#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) + +int main() +{ +} + +#else + +#include + +template struct pair +{ + T1 first; + T2 second; + + pair(): first(), second() + { + } +}; + +struct A +{ + A() = delete; +}; + +int main() +{ + boost::optional< pair > opt, opt2; + opt = opt2; +} + +#endif