diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp new file mode 100644 index 000000000..fa7d0a6b2 --- /dev/null +++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// + +// struct nullopt_t{see below}; +// constexpr nullopt_t nullopt(unspecified); + +// [optional.nullopt]/2: +// Type nullopt_t shall not have a default constructor or an initializer-list constructor. +// It shall not be an aggregate and shall be a literal type. +// Constant nullopt shall be initialized with an argument of literal type. + +#include +#include "test_macros.h" + +int main() +{ + std::nullopt_t n = {}; +} diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp index 84bb29fab..14a040cea 100644 --- a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp +++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp @@ -13,6 +13,11 @@ // struct nullopt_t{see below}; // constexpr nullopt_t nullopt(unspecified); +// [optional.nullopt]/2: +// Type nullopt_t shall not have a default constructor or an initializer-list constructor. +// It shall not be an aggregate and shall be a literal type. +// Constant nullopt shall be initialized with an argument of literal type. + #include #include @@ -29,9 +34,9 @@ test(const nullopt_t&) int main() { - static_assert((std::is_class::value), ""); - static_assert((std::is_empty::value), ""); - static_assert((std::is_literal_type::value), ""); + static_assert(( std::is_class::value), ""); + static_assert(( std::is_empty::value), ""); + static_assert(( std::is_literal_type::value), ""); static_assert((!std::is_default_constructible::value), ""); static_assert(test(nullopt) == 3, ""); diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 52c642365..f16afd989 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -386,7 +386,7 @@ 2732Questionable specification of path::operator/= and path::appendIssaquahComplete 2733[fund.ts.v2] gcd / lcm and boolIssaquah 2735std::abs(short), std::abs(signed char) and others should return int instead of double in order to be compatible with C++98 and CIssaquah - 2736nullopt_t insufficiently constrainedIssaquah + 2736nullopt_t insufficiently constrainedIssaquahComplete 2738is_constructible with void typesIssaquahComplete 2739Issue with time_point non-member subtraction with an unsigned durationIssaquahComplete 2740constexpr optional::operator->IssaquahComplete