Skip to content

Commit e1c8e47

Browse files
authored
Merge pull request #3446 from MicrosoftDocs/master
3/18/2021 AM Publish
2 parents 1cc0888 + 5a464f9 commit e1c8e47

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

docs/code-quality/c26432.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,33 @@ Special operations such as constructors are assumed to alter the behavior of typ
3030

3131
## Example
3232

33-
In this example, `warning::S` defines only a default constructor and a destructor. The `no_warning::S` declaration defines all five special member functions.
33+
In this example, `warning::S` defines only a default constructor and a destructor. The `no_warning::S` declaration defines or deletes all five special member functions.
3434

3535
```cpp
3636
// C26432.cpp
3737
namespace warning
3838
{
3939
struct S
4040
{
41-
S() noexcept {}
42-
~S() {} // C26432 because only the constructor and destructor are explicitly defined.
41+
S() noexcept { ++_count; }
42+
~S() { --_count; } // C26432 because only the constructor and destructor are explicitly defined.
43+
static unsigned _count;
4344
};
45+
unsigned S::_count = 0;
4446
}
4547

4648
namespace no_warning
4749
{
4850
struct S
4951
{
50-
S() noexcept {}
51-
S(const S& s) = default;
52-
S(S&& s) = default;
53-
S& operator=(const S& s) = default;
54-
S& operator=(S&& s) = default;
55-
~S() {}
52+
S() noexcept { _count++; }
53+
S(const S& s) = delete;
54+
S(S&& s) = delete;
55+
S& operator=(const S& s) = delete;
56+
S& operator=(S&& s) = delete;
57+
~S() { --_count; }
58+
static unsigned _count;
5659
};
60+
unsigned S::_count = 0;
5761
}
5862
```

docs/porting/visual-cpp-porting-and-upgrading-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.topic: "overview"
77
---
88
# Microsoft C++ porting and upgrading guide
99

10-
This article provides a guide for upgrading Microsoft C++ code to the latest version of Visual Studio. For projects created in Visual Studio 2010 through 2015, just open the project in Visual Studio 2019. You can upgrade a Visual Studio 2008 or earlier project in two steps. Use Visual Studio 2010 to convert the project to MSBuild format first. Then open the project in Visual Studio 2019. For complete instructions, see [Upgrading C++ projects from earlier versions of Visual Studio](upgrading-projects-from-earlier-versions-of-visual-cpp.md).
10+
This article provides a guide for upgrading Microsoft C++ code to the latest version of Visual Studio. For projects created in Visual Studio 2010 through 2017, just open the project in Visual Studio 2019. You can upgrade a Visual Studio 2008 or earlier project in two steps. Use Visual Studio 2010 to convert the project to MSBuild format first. Then open the project in Visual Studio 2019. For complete instructions, see [Upgrading C++ projects from earlier versions of Visual Studio](upgrading-projects-from-earlier-versions-of-visual-cpp.md).
1111

1212
The toolsets in Visual Studio 2015, Visual Studio 2017, and Visual Studio 2019 are binary-compatible. Now you can upgrade to a more recent version of the compiler without having to upgrade your library dependencies. For more information, see [C++ binary compatibility 2015-2019](binary-compat-2015-2017.md).
1313

0 commit comments

Comments
 (0)