Skip to content

Commit 93a18de

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#3119 from MicrosoftDocs/master637557465814877059
Repo sync for protected CLA branch
2 parents d2a85d4 + c1b22da commit 93a18de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3586
-232
lines changed

docs/c-runtime-library/reference/splitpath-s-wsplitpath-s.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Base filename (without extension). You can pass **NULL** for this parameter if y
8181
The size of the *fname* buffer in single-byte or wide characters. If *fname* is **NULL**, this value must be 0.
8282

8383
*ext*<br/>
84-
Filename extension, including leading period (**.**).You can pass **NULL** for this parameter if you do not need the filename extension.
84+
Filename extension, including leading period (**.**). You can pass **NULL** for this parameter if you do not need the filename extension.
8585

8686
*extNumberOfElements*<br/>
8787
The size of *ext* buffer in single-byte or wide characters. If *ext* is **NULL**, this value must be 0.

docs/code-quality/c6290.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.assetid: 96a1acc4-724b-4b56-b091-661ddcc03884
1313
1414
This warning indicates possible confusion in the use of an operator or an operator precedence.
1515

16-
The `!` operator yields a Boolean result, and it has higher precedence than the `&`.The bitwise-and (&) operator takes two arithmetic arguments. Therefore, one of the following errors has been detected:
16+
The `!` operator yields a Boolean result, and it has higher precedence than the `&`. The bitwise-and (&) operator takes two arithmetic arguments. Therefore, one of the following errors has been detected:
1717

1818
- The expression is mis-parenthesised:
1919

docs/cppcx/partial-classes-c-cx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following code fragment demonstrates accessibility. In the first partial cla
4242

4343
A partial definition of a class such as `MyClass` is only a declaration of MyClass. That is, it only introduces the name `MyClass`. `MyClass` can't be used in a way that requires a class definition, for example, knowing the size of `MyClass` or using a base or member of `MyClass`. `MyClass` is considered to be defined only when the compiler encounters a non-partial definition of `MyClass`.
4444

45-
The following example demonstrates the declaration behavior of a partial class. After declaration #1, `MyClass` can be used as if it were written as the forward declaration, `ref class MyClass;`. Declaration #2 is equivalent to declaration #1.Declaration #3 is valid because it's a forward declaration to a class. But declaration #4 is invalid because
45+
The following example demonstrates the declaration behavior of a partial class. After declaration #1, `MyClass` can be used as if it were written as the forward declaration, `ref class MyClass;`. Declaration #2 is equivalent to declaration #1. Declaration #3 is valid because it's a forward declaration to a class. But declaration #4 is invalid because
4646

4747
`MyClass` is not fully defined.
4848

docs/error-messages/compiler-errors-1/compiler-error-c2139.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
22
description: "Learn more about: Compiler Error C2139"
33
title: "Compiler Error C2139"
4-
ms.date: "11/04/2016"
4+
ms.date: 05/03/2021
55
f1_keywords: ["C2139"]
66
helpviewer_keywords: ["C2139"]
7-
ms.assetid: 31e047c0-5bf9-46c2-b6de-b627ea6a5768
87
---
98
# Compiler Error C2139
109

11-
'type' : an undefined class is not allowed as an argument to compiler intrinsic type trait 'trait'
10+
> '*type*' : an undefined class is not allowed as an argument to compiler intrinsic type trait '*trait*'
1211
1312
An invalid argument was passed to a type trait.
1413

14+
## Remarks
15+
1516
For more information, see [Compiler Support for Type Traits](../../extensions/compiler-support-for-type-traits-cpp-component-extensions.md).
1617

1718
## Example

docs/error-messages/compiler-errors-1/compiler-error-c2201.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
---
22
description: "Learn more about: Compiler Error C2201"
33
title: "Compiler Error C2201"
4-
ms.date: "11/04/2016"
4+
ms.date: 05/03/2021
55
f1_keywords: ["C2201"]
66
helpviewer_keywords: ["C2201"]
7-
ms.assetid: ed927659-6e9c-447d-9963-19969ae1e957
87
---
98
# Compiler Error C2201
109

11-
'identifier' : must have external linkage in order to be exported/imported
10+
> '*identifier*' : must have external linkage in order to be exported/imported
1211
1312
The exported identifier is **`static`**.
1413

15-
The following sample generates C2286:
14+
## Example
15+
16+
The following sample generates C2286, and shows how to fix it:
1617

1718
```cpp
1819
// C2201.cpp

docs/error-messages/compiler-errors-2/compiler-error-c2668.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
description: "Learn more about: Compiler Error C2668"
33
title: "Compiler Error C2668"
4-
ms.date: "03/28/2017"
4+
ms.date: 05/03/2021
55
f1_keywords: ["C2668"]
66
helpviewer_keywords: ["C2668"]
77
ms.assetid: 041e9627-1c76-420e-a653-cfc83f933bd3
88
---
99
# Compiler Error C2668
1010

11-
'function' : ambiguous call to overloaded function
11+
> 'function' : ambiguous call to overloaded function
1212
13-
The specified overloaded function call could not be resolved. You may want to explicitly cast one or more of the actual parameters.
13+
The specified overloaded function call couldn't be resolved. You may want to explicitly cast one or more of the actual parameters.
1414

15-
You can also get this error through template use. If, in the same class, you have a regular member function and a templated member function with the same signature, the templated one must come first. This is a limitation of the current implementation of Visual C++.
15+
You can also get this error through template use. If, in the same class, you have a regular member function and a templated member function with the same signature, the templated one must come first. This limitation remains in the current implementation of Visual C++.
1616

1717
## Examples
1818

@@ -34,7 +34,7 @@ int main() {
3434
}
3535
```
3636
37-
Another way to resolve this error is with a [using declaration](../../cpp/using-declaration.md):
37+
Another way to resolve this error is with a [`using` declaration](../../cpp/using-declaration.md):
3838
3939
```cpp
4040
// C2668b.cpp
@@ -75,9 +75,7 @@ class MyTestCase : public AppTestCase {
7575
};
7676
```
7777

78-
This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: ambiguous conversion on cast of constant 0.
79-
80-
Conversion on a cast using constant 0 is ambiguous since int requires a conversion both to long and to void*. To resolve this error, cast 0 to the exact type of the function parameter it is being used for so that no conversions need to take place (this code will be valid in the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++).
78+
Conversion on a cast using constant 0 is ambiguous since **`int`** requires a conversion both to **`long`** and to `void*`. To resolve this error, cast 0 to the exact type of the function parameter it's being used for. Then no conversions need to take place.
8179

8280
```cpp
8381
// C2668c.cpp
@@ -97,7 +95,7 @@ int main() {
9795
}
9896
```
9997
100-
This error can occur because the CRT now has float and double forms of all math functions.
98+
This error can occur because the CRT now has **`float`** and **`double`** forms of all math functions.
10199
102100
```cpp
103101
// C2668d.cpp
@@ -110,7 +108,7 @@ int main() {
110108
}
111109
```
112110

113-
This error can occur because the pow(int, int) was removed from math.h in the CRT.
111+
This error can occur because the `pow(int, int)` was removed from *`math.h`* in the CRT.
114112

115113
```cpp
116114
// C2668e.cpp
@@ -121,7 +119,7 @@ int main() {
121119
}
122120
```
123121

124-
This code succeeds in Visual Studio 2015 but fails in Visual Studio 2017 and later with C2668. In Visual Studio 2015, the compiler erroneously treated copy-list-initialization in the same way as regular copy-initialization; it considered only converting constructors for overload resolution.
122+
This code succeeds in Visual Studio 2015 but fails in Visual Studio 2017 and later with C2668. In Visual Studio 2015, the compiler erroneously treated copy-list-initialization in the same way as regular copy-initialization. It considered only converting constructors for overload resolution.
125123

126124
```cpp
127125
struct A {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: "Learn about the causes of Compiler error C7536 and how to fix it."
3+
title: "Compiler Error C7536"
4+
ms.date: 05/03/2021
5+
f1_keywords: ["C7536"]
6+
helpviewer_keywords: ["C7536"]
7+
---
8+
# Compiler Error C7536
9+
10+
> ifc failed integrity checks. Expected SHA2: '*hash-value*'
11+
12+
The compiler raises C7536 whenever the *`.ifc`* file has been tampered with. The header of the module interface contains an SHA2 hash of the contents below it. On import, the *`.ifc`* file is hashed, then checked against the hash provided in the header. If these don't match, error C7536 is raised:
13+
14+
```Output
15+
error C7536: ifc failed integrity checks.
16+
Expected SHA2: '66d5c8154df0c71d4cab7665bab4a125c7ce5cb9a401a4d8b461b706ddd771c6'
17+
```
18+
19+
This error is new in Visual Studio 2017 version 15.9. It's only generated when creating or consuming modules, specified by the `/experimental:module` compiler option.

docs/error-messages/compiler-errors-2/compiler-errors-c7500-through-c7999.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
description: "Learn more about: Compiler errors C7500 through C7999"
33
title: "Compiler errors C7500 through C7999"
44
ms.date: 04/18/2021
5-
f1_keywords: ["C7500", "C7501", "C7502", "C7503", "C7504", "C7505", "C7506", "C7507", "C7508", "C7509", "C7511", "C7512", "C7513", "C7514", "C7515", "C7516", "C7517", "C7518", "C7519", "C7520", "C7521", "C7522", "C7523", "C7524", "C7525", "C7526", "C7527", "C7528", "C7529", "C7530", "C7531", "C7532", "C7533", "C7534", "C7535", "C7536", "C7537", "C7538", "C7539", "C7540", "C7541", "C7542", "C7543", "C7544", "C7545", "C7546", "C7547", "C7548", "C7549", "C7550", "C7551", "C7552", "C7553", "C7554", "C7555", "C7556", "C7557", "C7558", "C7559", "C7560", "C7561", "C7562", "C7563", "C7564", "C7565", "C7566", "C7567", "C7568", "C7569", "C7570", "C7571", "C7572", "C7573", "C7574", "C7575", "C7576", "C7577", "C7578", "C7579", "C7580", "C7581", "C7582", "C7583", "C7584", "C7585", "C7586", "C7587", "C7588", "C7589", "C7590", "C7591", "C7592", "C7593", "C7594", "C7595", "C7596", "C7597", "C7599", "C7600", "C7601", "C7602", "C7603", "C7604", "C7605", "C7606", "C7607", "C7608", "C7609", "C7610", "C7611", "C7612", "C7613", "C7614", "C7615", "C7616", "C7617", "C7618", "C7619", "C7620", "C7621", "C7622", "C7623", "C7624", "C7625", "C7627", "C7628", "C7629", "C7630", "C7631", "C7632", "C7633", "C7634", "C7635", "C7636", "C7637", "C7638", "C7639", "C7640", "C7641", "C7642", "C7643", "C7644", "C7645", "C7646", "C7647", "C7648", "C7649", "C7650", "C7651", "C7652", "C7653", "C7654", "C7655", "C7656", "C7657", "C7658", "C7659", "C7660", "C7661", "C7662", "C7700", "C7701", "C7702", "C7703", "C7704"]
6-
helpviewer_keywords: ["C7500", "C7501", "C7502", "C7503", "C7504", "C7505", "C7506", "C7507", "C7508", "C7509", "C7511", "C7512", "C7513", "C7514", "C7515", "C7516", "C7517", "C7518", "C7519", "C7520", "C7521", "C7522", "C7523", "C7524", "C7525", "C7526", "C7527", "C7528", "C7529", "C7530", "C7531", "C7532", "C7533", "C7534", "C7535", "C7536", "C7537", "C7538", "C7539", "C7540", "C7541", "C7542", "C7543", "C7544", "C7545", "C7546", "C7547", "C7548", "C7549", "C7550", "C7551", "C7552", "C7553", "C7554", "C7555", "C7556", "C7557", "C7558", "C7559", "C7560", "C7561", "C7562", "C7563", "C7564", "C7565", "C7566", "C7567", "C7568", "C7569", "C7570", "C7571", "C7572", "C7573", "C7574", "C7575", "C7576", "C7577", "C7578", "C7579", "C7580", "C7581", "C7582", "C7583", "C7584", "C7585", "C7586", "C7587", "C7588", "C7589", "C7590", "C7591", "C7592", "C7593", "C7594", "C7595", "C7596", "C7597", "C7599", "C7600", "C7601", "C7602", "C7603", "C7604", "C7605", "C7606", "C7607", "C7608", "C7609", "C7610", "C7611", "C7612", "C7613", "C7614", "C7615", "C7616", "C7617", "C7618", "C7619", "C7620", "C7621", "C7622", "C7623", "C7624", "C7625", "C7627", "C7628", "C7629", "C7630", "C7631", "C7632", "C7633", "C7634", "C7635", "C7636", "C7637", "C7638", "C7639", "C7640", "C7641", "C7642", "C7643", "C7644", "C7645", "C7646", "C7647", "C7648", "C7649", "C7650", "C7651", "C7652", "C7653", "C7654", "C7655", "C7656", "C7657", "C7658", "C7659", "C7660", "C7661", "C7662", "C7700", "C7701", "C7702", "C7703", "C7704"]
5+
f1_keywords: ["C7500", "C7501", "C7502", "C7503", "C7504", "C7505", "C7506", "C7507", "C7508", "C7509", "C7511", "C7512", "C7513", "C7514", "C7515", "C7516", "C7517", "C7518", "C7519", "C7520", "C7521", "C7522", "C7523", "C7524", "C7525", "C7526", "C7527", "C7528", "C7529", "C7530", "C7531", "C7532", "C7533", "C7534", "C7535", "C7537", "C7538", "C7539", "C7540", "C7541", "C7542", "C7543", "C7544", "C7545", "C7546", "C7547", "C7548", "C7549", "C7550", "C7551", "C7552", "C7553", "C7554", "C7555", "C7556", "C7557", "C7558", "C7559", "C7560", "C7561", "C7562", "C7563", "C7564", "C7565", "C7566", "C7567", "C7568", "C7569", "C7570", "C7571", "C7572", "C7573", "C7574", "C7575", "C7576", "C7577", "C7578", "C7579", "C7580", "C7581", "C7582", "C7583", "C7584", "C7585", "C7586", "C7587", "C7588", "C7589", "C7590", "C7591", "C7592", "C7593", "C7594", "C7595", "C7596", "C7597", "C7599", "C7600", "C7601", "C7602", "C7603", "C7604", "C7605", "C7606", "C7607", "C7608", "C7609", "C7610", "C7611", "C7612", "C7613", "C7614", "C7615", "C7616", "C7617", "C7618", "C7619", "C7620", "C7621", "C7622", "C7623", "C7624", "C7625", "C7627", "C7628", "C7629", "C7630", "C7631", "C7632", "C7633", "C7634", "C7635", "C7636", "C7637", "C7638", "C7639", "C7640", "C7641", "C7642", "C7643", "C7644", "C7645", "C7646", "C7647", "C7648", "C7649", "C7650", "C7651", "C7652", "C7653", "C7654", "C7655", "C7656", "C7657", "C7658", "C7659", "C7660", "C7661", "C7662", "C7700", "C7701", "C7702", "C7703", "C7704"]
6+
helpviewer_keywords: ["C7500", "C7501", "C7502", "C7503", "C7504", "C7505", "C7506", "C7507", "C7508", "C7509", "C7511", "C7512", "C7513", "C7514", "C7515", "C7516", "C7517", "C7518", "C7519", "C7520", "C7521", "C7522", "C7523", "C7524", "C7525", "C7526", "C7527", "C7528", "C7529", "C7530", "C7531", "C7532", "C7533", "C7534", "C7535", "C7537", "C7538", "C7539", "C7540", "C7541", "C7542", "C7543", "C7544", "C7545", "C7546", "C7547", "C7548", "C7549", "C7550", "C7551", "C7552", "C7553", "C7554", "C7555", "C7556", "C7557", "C7558", "C7559", "C7560", "C7561", "C7562", "C7563", "C7564", "C7565", "C7566", "C7567", "C7568", "C7569", "C7570", "C7571", "C7572", "C7573", "C7574", "C7575", "C7576", "C7577", "C7578", "C7579", "C7580", "C7581", "C7582", "C7583", "C7584", "C7585", "C7586", "C7587", "C7588", "C7589", "C7590", "C7591", "C7592", "C7593", "C7594", "C7595", "C7596", "C7597", "C7599", "C7600", "C7601", "C7602", "C7603", "C7604", "C7605", "C7606", "C7607", "C7608", "C7609", "C7610", "C7611", "C7612", "C7613", "C7614", "C7615", "C7616", "C7617", "C7618", "C7619", "C7620", "C7621", "C7622", "C7623", "C7624", "C7625", "C7627", "C7628", "C7629", "C7630", "C7631", "C7632", "C7633", "C7634", "C7635", "C7636", "C7637", "C7638", "C7639", "C7640", "C7641", "C7642", "C7643", "C7644", "C7645", "C7646", "C7647", "C7648", "C7649", "C7650", "C7651", "C7652", "C7653", "C7654", "C7655", "C7656", "C7657", "C7658", "C7659", "C7660", "C7661", "C7662", "C7700", "C7701", "C7702", "C7703", "C7704"]
77
---
88
# Compiler errors C7500 through C7999
99

@@ -51,7 +51,7 @@ The articles in this section of the documentation explain a subset of the error
5151
| Compiler error C7533 | '%$S': template arguments not allowed in this context |
5252
| Compiler error C7534 | syntax error: '%$L': expected class definition to end with '}' |
5353
| Compiler error C7535 | '%$S': delegating constructor calls itself |
54-
| Compiler error C7536 | ifc failed integrity checks. Expected SHA2: '%s' |
54+
| [Compiler error C7536](compiler-error-c7536.md) | ifc failed integrity checks. Expected SHA2: '*hash-value*' |
5555
| Compiler error C7537 | failed to properly compute SHA2 hash: '%s' |
5656
| Compiler error C7538 | '%$I' is not a variable template |
5757
| Compiler error C7539 | '%1$I': a class with user-declared constructors cannot have a member with the same name as the class |
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
description: "Learn more about: Compiler Warning (error) C4597"
3+
title: "Compiler Warning (error) C4597"
4+
ms.date: 05/03/2021
5+
f1_keywords: ["C4597"]
6+
helpviewer_keywords: ["C4597"]
7+
---
8+
# Compiler Warning (error) C4597
9+
10+
> undefined behavior: `offsetof` applied to a member of a virtual base
11+
12+
Using `offsetof(T, m)` where *`m`* refers to a static data member or a member function results in C4597.
13+
14+
## Remarks
15+
16+
This warning is new in Visual Studio 2017 version 15.3. It's reported as an error by default. For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
17+
18+
## Example
19+
20+
The following code produces error C4597:
21+
22+
```cpp
23+
#include <cstddef>
24+
25+
struct A {
26+
int ten() { return 10; }
27+
static constexpr int two = 2;
28+
};
29+
30+
constexpr auto off = offsetof(A, ten); // C4597: undefined behavior: offsetof applied to member function 'A::ten'
31+
constexpr auto off2 = offsetof(A, two); // C4597: undefined behavior: offsetof applied to static data member 'A::two'
32+
```
33+
34+
This code is ill-formed and could potentially cause a crash at runtime. To fix the error, change the code: don't invoke `offsetof` on member functions or static data members. It's non-portable code that's disallowed by the C++ standard.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: "Learn more about: Compiler Warning (level 3) C4768"
3+
title: "Compiler Warning (level 3) C4768"
4+
ms.date: 05/03/2021
5+
f1_keywords: ["C4768"]
6+
helpviewer_keywords: ["C4768"]
7+
---
8+
# Compiler Warning (level 3) C4768
9+
10+
> `__declspec` attributes before linkage specification are ignored
11+
12+
The compiler warns if `__declspec(...)` is applied before the `extern "C"` linkage specification. Previously, the compiler would ignore the attribute, which could have runtime implications.
13+
14+
## Remarks
15+
16+
This warning is new in Visual Studio 2017 version 15.3, which left it off by default. It's enabled by default as a level 3 warning starting in Visual Studio 2017 version 15.5. For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
17+
18+
## Example
19+
20+
The following code produces warning C4768:
21+
22+
```cpp
23+
__declspec(noinline) extern "C" HRESULT __stdcall // C4768: __declspec attributes before linkage specification are ignored
24+
```
25+
26+
To fix the warning, put `extern "C"` first:
27+
28+
```cpp
29+
extern "C" __declspec(noinline) HRESULT __stdcall
30+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
description: "Learn more about: Compiler Warning (level 4) C4841"
3+
title: "Compiler Warning (level 4) C4841"
4+
ms.date: 05/03/2021
5+
f1_keywords: ["C4841"]
6+
helpviewer_keywords: ["C4841"]
7+
---
8+
# Compiler Warning (level 4) C4841
9+
10+
> non-standard extension used: compound member designator used in `offsetof`
11+
12+
## Remarks
13+
14+
If you use `offsetof(T, m)`, where *`m`* is a compound member designator, the compiler generates a warning when you compile with the **`/Wall`** option.
15+
16+
This warning is new in Visual Studio 2017 version 15.3, and is off by default. Use [`/Wall`](../../build/reference/compiler-option-warning-level.md) to enable all warnings that are off by default, or **`/w14841`** to enable C4841 as a level 1 warning. For more information, see [Compiler warnings that are off by default](../../preprocessor/compiler-warnings-that-are-off-by-default.md). For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
17+
18+
## Example
19+
20+
The following code is ill-formed and could potentially cause a crash at runtime:
21+
22+
```cpp
23+
struct A {
24+
int arr[10];
25+
};
26+
27+
// warning C4841: non-standard extension used: compound member designator in offsetof
28+
constexpr auto off = offsetof(A, arr[2]);
29+
```
30+
31+
To fix the issue, change the code to not use `offsetof` with a compound member designator.

0 commit comments

Comments
 (0)