Skip to content

Commit 88eb05c

Browse files
authored
Merge pull request #5486 from Rageking8/add-cpp-language-for-code-blocks-in-error-or-warning-references
Add `cpp` language for code blocks in error or warning references
2 parents a6bd7e5 + 546fefb commit 88eb05c

File tree

6 files changed

+22
-28
lines changed

6 files changed

+22
-28
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Error C2797"
32
title: "Compiler Error C2797"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2797"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2797"]
66
helpviewer_keywords: ["C2797"]
7-
ms.assetid: 9fb26d35-eb5c-46fc-9ff5-756fba5bdaff
87
---
98
# Compiler Error C2797
109

@@ -14,7 +13,7 @@ This warning is obsolete in Visual Studio 2015. In Visual Studio 2013 and earlie
1413

1514
This example generates C2797:
1615

17-
```
16+
```cpp
1817
#include <vector>
1918
struct S {
2019
S() : v1{1} {} // C2797, VS2013 RTM incorrectly calls 'vector(size_type)'
@@ -26,7 +25,7 @@ struct S {
2625
2726
This example also generates C2797:
2827
29-
```
28+
```cpp
3029
struct S1 {
3130
int i;
3231
};
@@ -40,7 +39,7 @@ struct S2 {
4039

4140
To fix this issue, you can use explicit construction of inner lists. For example:
4241

43-
```
42+
```cpp
4443
#include <vector>
4544
typedef std::vector<int> Vector;
4645
struct S {
@@ -53,7 +52,7 @@ struct S {
5352
5453
If you do not require list initialization:
5554
56-
```
55+
```cpp
5756
struct S {
5857
S() : s1("") {}
5958

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
---
2-
description: "Learn more about: Compiler Error C2891"
32
title: "Compiler Error C2891"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2891"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C2891"]
66
helpviewer_keywords: ["C2891"]
7-
ms.assetid: e12cfb2d-df45-4b0d-b155-c51d17e812fa
87
---
98
# Compiler Error C2891
109

1110
'parameter' : cannot take the address of a template parameter
1211

1312
You can't take the address of a template parameter unless it is an lvalue. Type parameters are not lvalues because they have no address. Non-type values in template parameter lists that are not lvalues also do not have an address. This is an example of code that causes Compiler Error C2891, because the value passed as the template parameter is a compiler-generated copy of the template argument.
1413

15-
```
14+
```cpp
1615
template <int i> int* f() { return &i; }
1716
```
1817
1918
Template parameters that are lvalues, such as reference types, can have their address taken.
2019
21-
```
20+
```cpp
2221
template <int& r> int* f() { return &r; }
2322
```
2423

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Error C3457"
32
title: "Compiler Error C3457"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3457"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3457"]
66
helpviewer_keywords: ["C3457"]
7-
ms.assetid: 5c1e366a-fa75-4cca-b9a3-86d4ebe4090e
87
---
98
# Compiler Error C3457
109

@@ -16,7 +15,7 @@ Source annotation attributes, unlike CLR custom attribute or compiler attributes
1615

1716
The following sample generates C3457.
1817

19-
```
18+
```cpp
2019
#include "SourceAnnotations.h"
2120
[vc_attributes::Post( 1 )] int f(); // C3457
2221
[vc_attributes::Post( Valid=vc_attributes::Yes )] int f2(); // OK
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
description: "Learn more about: Compiler Error C3554"
32
title: "Compiler Error C3554"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3554"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3554"]
66
helpviewer_keywords: ["C3554"]
7-
ms.assetid: aede18d5-fefc-4da9-9b69-adfe90bfa742
87
---
98
# Compiler Error C3554
109

1110
'decltype' cannot be combined with any other type-specifier
1211

1312
You cannot qualify the `decltype()` keyword with any type specifier. For example, the following code fragment yields error C3554.
1413

15-
```
14+
```cpp
1615
int x;
1716
unsigned decltype(x); // C3554
1817
```

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Error C3733"
32
title: "Compiler Error C3733"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C3733"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C3733"]
66
helpviewer_keywords: ["C3733"]
7-
ms.assetid: 0cc1a9fe-1400-4be3-b35a-16435cba7a5a
87
---
98
# Compiler Error C3733
109

@@ -14,7 +13,7 @@ The wrong syntax was used for a COM event. To fix this error, change the event t
1413

1514
The following sample generates C3733:
1615

17-
```
16+
```cpp
1817
#define _ATL_ATTRIBUTES 1
1918
#include "atlbase.h"
2019
#include "atlcom.h"

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4626.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 4) C4626"
32
title: "Compiler Warning (level 4) C4626"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 4) C4626"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4626"]
66
helpviewer_keywords: ["C4626"]
7-
ms.assetid: 7f822ff4-a4a3-4f17-b45b-e8b7b4659a14
87
---
98
# Compiler Warning (level 4) C4626
109

@@ -16,7 +15,7 @@ This warning is off by default. See [Compiler Warnings That Are Off by Default](
1615

1716
The following sample generates C4626 and shows how to fix it:
1817

19-
```
18+
```cpp
2019
// C4626
2120
// compile with: /W4
2221
#pragma warning(default : 4626)

0 commit comments

Comments
 (0)