Skip to content

Commit

Permalink
<expected> Implement P0323: expected
Browse files Browse the repository at this point in the history
Fixes #2529
  • Loading branch information
miscco committed Apr 8, 2022
1 parent e7f5b27 commit fafd5d0
Show file tree
Hide file tree
Showing 11 changed files with 2,918 additions and 3 deletions.
1 change: 1 addition & 0 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/inc/deque
${CMAKE_CURRENT_LIST_DIR}/inc/exception
${CMAKE_CURRENT_LIST_DIR}/inc/execution
${CMAKE_CURRENT_LIST_DIR}/inc/expected
${CMAKE_CURRENT_LIST_DIR}/inc/experimental/coroutine
${CMAKE_CURRENT_LIST_DIR}/inc/experimental/deque
${CMAKE_CURRENT_LIST_DIR}/inc/experimental/filesystem
Expand Down
1 change: 1 addition & 0 deletions stl/inc/__msvc_all_public_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#include <complex>
#include <deque>
#include <exception>
#include <expected>
#include <filesystem>
#include <format>
#include <forward_list>
Expand Down
1,020 changes: 1,020 additions & 0 deletions stl/inc/expected

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions stl/inc/header-units.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"deque",
"exception",
"execution",
"expected",
"filesystem",
"format",
"forward_list",
Expand Down
12 changes: 9 additions & 3 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@

// _HAS_CXX23 directly controls:
// P0288R9 move_only_function
// P0323R12 <expected>
// P0401R6 Providing Size Feedback In The Allocator Interface
// P0448R4 <spanstream>
// P0627R6 unreachable()
Expand Down Expand Up @@ -1372,9 +1373,14 @@

#define __cpp_lib_associative_heterogeneous_erasure 202110L
#define __cpp_lib_byteswap 202110L
#define __cpp_lib_invoke_r 202106L
#define __cpp_lib_is_scoped_enum 202011L
#define __cpp_lib_move_only_function 202110L

#ifdef __cpp_lib_concepts
#define __cpp_lib_expected 202202L
#endif // __cpp_lib_concepts

#define __cpp_lib_invoke_r 202106L
#define __cpp_lib_is_scoped_enum 202011L
#define __cpp_lib_move_only_function 202110L

#ifdef __cpp_lib_concepts
#define __cpp_lib_out_ptr 202106L
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ tests\P0220R1_searchers
tests\P0220R1_string_view
tests\P0288R9_move_only_function
tests\P0295R0_gcd_lcm
tests\P0323R12_expected
tests\P0325R4_to_array
tests\P0339R6_polymorphic_allocator
tests\P0355R7_calendars_and_time_zones_clocks
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P0323R12_expected/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\strict_concepts_latest_matrix.lst
1,865 changes: 1,865 additions & 0 deletions tests/std/tests/P0323R12_expected/test.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"deque",
"exception",
"execution",
"expected",
"filesystem",
"format",
"forward_list",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import <coroutine>;
import <deque>;
import <exception>;
import <execution>;
import <expected>;
import <filesystem>;
import <format>;
import <forward_list>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,20 @@ STATIC_ASSERT(__cpp_lib_execution == 201603L);
#endif
#endif

#if _HAS_CXX23
#ifndef __cpp_lib_expected
#error __cpp_lib_expected is not defined
#elif __cpp_lib_expected != 202202L
#error __cpp_lib_expected is not 202202L
#else
STATIC_ASSERT(__cpp_lib_expected == 202202L);
#endif
#else
#ifdef __cpp_lib_expected
#error __cpp_lib_expected is defined
#endif
#endif

#ifndef __cpp_lib_experimental_erase_if
#error __cpp_lib_experimental_erase_if is not defined
#elif __cpp_lib_experimental_erase_if != 201411L
Expand Down

0 comments on commit fafd5d0

Please sign in to comment.