Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test updates for LLVM18 #4452

Merged
merged 6 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/std/include/test_format_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ template <typename CharT>
struct testing_callbacks {
std::_Fmt_align expected_alignment = std::_Fmt_align::_None;
std::_Fmt_sign expected_sign = std::_Fmt_sign::_None;
std::basic_string_view<CharT> expected_fill;
std::basic_string_view<CharT> expected_fill{};
int expected_width = -1;
std::size_t expected_dynamic_width = static_cast<std::size_t>(-1);
bool expected_auto_dynamic_width = false;
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/GH_000431_equal_family/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@ void test_algorithms(EqualFn equal_fn) {
assert(equal_fn(begin(arr2), end(arr2), begin(arr3), end(arr3), equal_to<short>{}));
assert(equal_fn(begin(arr2), end(arr2), begin(arr3), end(arr3), equal_to<int>{}));

#if !_HAS_CXX23
// The return type of equal_to<void>::operator()(T, U) SFINAEs
// when T and U are different enumeration types.
assert(equal_fn(begin(arr3), end(arr3), begin(arr4), end(arr4), equal_to<>{}));
#endif // !_HAS_CXX23
Comment on lines +247 to +251
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built-in comparison between different enumeration types is removed in C++26 via WG21-P2864R2.

It seems that Clang only applies the removal to C++26 mode (Godbolt link). Why is C++23 mode affected?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly because we're passing /std:c++latest and it's being detected as C++26?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, /std:c++latest is probably mapped to -std=c++2c by Clang 18+ so C++26 core features become available (Godbolt link). 😿 There seems an issue that we can't specify C++23 mode because /std:c++23 is not yet available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really this ought to be // TRANSITION, _HAS_CXX26 but it's not worth resetting testing.

assert(equal_fn(begin(arr3), end(arr3), begin(arr4), end(arr4), equal_to<short>{}));
assert(equal_fn(begin(arr3), end(arr3), begin(arr4), end(arr4), equal_to<int>{}));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifdef __clang__
#pragma clang diagnostic ignored "-Wnan-infinity-disabled"
#endif // __clang__

#include <cassert>
#include <complex>
#include <limits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template <typename CharT>
template <typename CharT>
struct testing_callbacks {
_Fmt_align expected_alignment = _Fmt_align::_None;
basic_string_view<CharT> expected_fill;
basic_string_view<CharT> expected_fill{};
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
int expected_width = -1;
size_t expected_dynamic_width = static_cast<size_t>(-1);
bool expected_auto_dynamic_width = false;
Expand Down
18 changes: 9 additions & 9 deletions tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,15 +1943,15 @@ namespace iter_ops {
std::random_access_iterator_tag;

struct trace {
unsigned int compares_;
unsigned int differences_;
unsigned int increments_;
unsigned int decrements_;
unsigned int assignments_;
unsigned int seeks_;
unsigned int sizes_;
unsigned int begins_;
unsigned int ends_;
unsigned int compares_ = 0;
unsigned int differences_ = 0;
unsigned int increments_ = 0;
unsigned int decrements_ = 0;
unsigned int assignments_ = 0;
unsigned int seeks_ = 0;
unsigned int sizes_ = 0;
unsigned int begins_ = 0;
unsigned int ends_ = 0;

bool operator==(trace const&) const = default;
};
Expand Down
17 changes: 8 additions & 9 deletions tests/std/tests/P2093R14_formatted_output/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ namespace test {
public:
// Construct a new semaphore in the parent process.
win_semaphore() {
SECURITY_ATTRIBUTES semaphore_attributes{
.nLength = sizeof(SECURITY_ATTRIBUTES),
.bInheritHandle = TRUE, // The child process will inherit this handle.
};
SECURITY_ATTRIBUTES semaphore_attributes{};
semaphore_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
semaphore_attributes.bInheritHandle = TRUE; // The child process will inherit this handle.

m_handle = CreateSemaphoreW(&semaphore_attributes, 0, 1, nullptr);
assert(m_handle != nullptr);
}
Expand Down Expand Up @@ -648,11 +648,10 @@ int main(int argc, char* argv[]) {

// The entire purpose of this code is to hide the child process's console window,
// to avoid rapid flickering during test runs.
STARTUPINFOW startup_info{
.cb = sizeof(STARTUPINFOW),
.dwFlags = STARTF_USESHOWWINDOW,
.wShowWindow = SW_HIDE,
};
STARTUPINFOW startup_info{};
startup_info.cb = sizeof(STARTUPINFOW);
startup_info.dwFlags = STARTF_USESHOWWINDOW;
startup_info.wShowWindow = SW_HIDE;

constexpr BOOL inherit_handles = TRUE;

Expand Down
6 changes: 3 additions & 3 deletions tests/std/tests/floating_point_model_matrix.lst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ ASAN PM_CL="/O2 /MD /permissive- -fsanitize=address /Zi" PM_LINK="/debug"
PM_CL="/O2 /MT /GL"
ASAN PM_CL="/O2 /MT /GL -fsanitize=address /Zi" PM_LINK="/debug"
# TRANSITION, -Wno-unused-command-line-argument is needed for the internal test harness
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-overriding-t-option /Od /MTd"
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-overriding-t-option /O2 /MT"
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-overriding-t-option /O2 /MD /Oi-"
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-overriding-t-option -Wno-overriding-option /Od /MTd"
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-overriding-t-option -Wno-overriding-option /O2 /MT"
PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-overriding-t-option -Wno-overriding-option /O2 /MD /Oi-"