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

Add an STL-wide suppression for C5246 #4527

Merged
merged 2 commits into from
Mar 28, 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
3 changes: 2 additions & 1 deletion stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,14 +805,15 @@
// warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified (/Wall)
// warning C5220: a non-static data member with a volatile qualified type no longer implies that compiler generated
// copy/move constructors and copy/move assignment operators are not trivial (/Wall)
// warning C5246: 'member': the initialization of a subobject should be wrapped in braces (/Wall)
// warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed

#ifndef _STL_DISABLED_WARNINGS
// clang-format off
#define _STL_DISABLED_WARNINGS \
4180 4324 4412 4455 4494 4514 4574 4582 4583 4587 \
4588 4619 4623 4625 4626 4643 4648 4702 4793 4820 \
4868 4988 5026 5027 5045 5220 6294 \
4868 4988 5026 5027 5045 5220 5246 6294 \
_STL_DISABLED_WARNING_C4577 \
_STL_DISABLED_WARNING_C4984 \
_STL_DISABLED_WARNING_C5053 \
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ tests\GH_004129_conversion_in_new_numeric_algorithms
tests\GH_004201_chrono_formatter
tests\GH_004275_seeking_fancy_iterators
tests\GH_004388_unordered_meow_operator_equal
tests\GH_004477_mdspan_warning_5246
tests\LWG2381_num_get_floating_point
tests\LWG2597_complex_branch_cut
tests\LWG3018_shared_ptr_function
Expand Down
6 changes: 6 additions & 0 deletions tests/std/tests/GH_004477_mdspan_warning_5246/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_latest_matrix.lst
RUNALL_CROSSLIST
* PM_CL="/w15246"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <array>
#include <cstddef>
#include <mdspan>

using namespace std;

// Test GH-4477 "Using std::mdspan results in multiple warnings (C5246)"
void test_gh_4477() {
array test_data{0, 1, 2, 3, 4, 5};
mdspan<int, dextents<size_t, 2>> test_span(test_data.data(), 2, 3);
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
(void) test_span;
}