-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
extern "C++"
as a temporary workaround for #include
/import
…
…coexistence (#4154)
- Loading branch information
1 parent
d3873a5
commit 46843b3
Showing
13 changed files
with
147 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/std/tests/P2465R3_standard_library_modules/test3.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifdef _MSVC_INTERNAL_TESTING // TRANSITION, VS 2022 17.9 Preview 3 | ||
#include <__msvc_all_public_headers.hpp> | ||
#else // ^^^ no workaround / workaround vvv | ||
#include <assert.h> // intentionally not <cassert> | ||
#endif // ^^^ workaround ^^^ | ||
|
||
import std; | ||
|
||
// INTENTIONALLY AVOIDED: using namespace std; | ||
|
||
void test_include_all_then_import_std() { | ||
// Verify that std::vector and std::ranges algorithms are available: | ||
std::vector<int> v{31, 41, 59, 26, 53, 58, 97, 93}; | ||
assert(!std::ranges::is_sorted(v)); | ||
std::ranges::sort(v); | ||
assert(std::ranges::is_sorted(v)); | ||
const std::vector<int> sorted{26, 31, 41, 53, 58, 59, 93, 97}; | ||
assert(v == sorted); | ||
|
||
// Verify that the Sufficient Additional Overloads are available for std::sqrt(): | ||
assert(std::sqrt(25.0) == 5.0); | ||
assert(std::sqrt(25.0f) == 5.0f); | ||
assert(std::sqrt(25) == 5.0); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25.0)), double>); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25.0f)), float>); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25)), double>); | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/std/tests/P2465R3_standard_library_modules/test4.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#ifdef _MSVC_INTERNAL_TESTING // TRANSITION, VS 2022 17.9 Preview 3 | ||
#include <__msvc_all_public_headers.hpp> | ||
#else // ^^^ no workaround / workaround vvv | ||
#include <assert.h> // intentionally not <cassert> | ||
#endif // ^^^ workaround ^^^ | ||
|
||
import std.compat; | ||
|
||
// INTENTIONALLY AVOIDED: using namespace std; | ||
|
||
void test_include_all_then_import_std_compat() { | ||
// Verify that std::vector and std::ranges algorithms are available: | ||
std::vector<int> v{31, 41, 59, 26, 53, 58, 97, 93}; | ||
assert(!std::ranges::is_sorted(v)); | ||
std::ranges::sort(v); | ||
assert(std::ranges::is_sorted(v)); | ||
const std::vector<int> sorted{26, 31, 41, 53, 58, 59, 93, 97}; | ||
assert(v == sorted); | ||
|
||
// Verify that the Sufficient Additional Overloads are available for std::sqrt(): | ||
assert(std::sqrt(25.0) == 5.0); | ||
assert(std::sqrt(25.0f) == 5.0f); | ||
assert(std::sqrt(25) == 5.0); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25.0)), double>); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25.0f)), float>); | ||
static_assert(std::is_same_v<decltype(std::sqrt(25)), double>); | ||
|
||
// Verify that the Sufficient Additional Overloads are available for ::sqrt(): | ||
assert(::sqrt(25.0) == 5.0); | ||
assert(::sqrt(25.0f) == 5.0f); | ||
assert(::sqrt(25) == 5.0); | ||
static_assert(std::is_same_v<decltype(::sqrt(25.0)), double>); | ||
static_assert(std::is_same_v<decltype(::sqrt(25.0f)), float>); | ||
static_assert(std::is_same_v<decltype(::sqrt(25)), double>); | ||
} |