office-gobmx/include/o3tl/optional.hxx
Stephan Bergmann b9f43acf9c Better not use constexpr here
With a locally modified include/o3tl/optional.hxx to always pick the
boost::optional branch, to prepare <https://gerrit.libreoffice.org/#/c/84672/>
"Fix more new dependencies on boost_headers", that constexpr caused

> In file included from idlc/source/errorhandler.cxx:20:
> In file included from idlc/inc/errorhandler.hxx:23:
> In file included from idlc/inc/astexpression.hxx:27:
> include/o3tl/optional.hxx:28:23: error: constexpr variable cannot have non-literal type 'const boost::none_t'
> inline constexpr auto nullopt = boost::none;
>                       ^
> workdir/UnpackedTarball/boost/boost/none_t.hpp:29:8: note: 'none_t' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors
> struct none_t
>        ^

at least with recent Clang 10 trunk and --without-system-boost.

Change-Id: I679a6ca5d135d3f5571845a15afe20d28a1f9039
Reviewed-on: https://gerrit.libreoffice.org/84673
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-07 13:51:56 +01:00

46 lines
1 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// A wrapper selecting either std::optional or boost::optional as a fallback for Xcode < 10. To be
// removed once std::optional is available everywhere.
#ifndef INCLUDED_O3TL_OPTIONAL_HXX
#define INCLUDED_O3TL_OPTIONAL_HXX
#include <sal/config.h>
#if defined __APPLE__ && !__has_include(<optional>)
#include <boost/none.hpp>
#include <boost/optional.hpp>
namespace o3tl
{
using boost::make_optional;
using boost::optional;
inline auto const nullopt = boost::none;
}
#else
#include <optional>
namespace o3tl
{
using std::make_optional;
using std::nullopt;
using std::optional;
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */