You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp-conformance-improvements-2017.md
+16-15Lines changed: 16 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
2
title: "C++ compiler conformance improvements | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/16/2016"
4
+
ms.date: "06/05/2017"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology:
8
8
- "vs-ide-general"
9
9
ms.tgt_pltfrm: ""
10
10
ms.topic: "article"
11
11
ms.assetid: 8801dbdb-ca0b-491f-9e33-01618bff5ae9
12
-
author: "BrianPeek"
13
-
ms.author: "brpeek"
12
+
author: "mikeblome"
13
+
ms.author: "mblome"
14
14
manager: "ghogen"
15
15
translation.priority.ht:
16
16
- "cs-cz"
@@ -143,7 +143,7 @@ int main()
143
143
```
144
144
145
145
### constexpr
146
-
Visual Studio 2017 correctly raises an error when the left-hand operand of a conditionally evaluating operation is not valid in a constexpr context. The following code compiles in Visual Studio 2015 but not in Visual Studio 2017:
146
+
Visual Studio 2017 correctly raises an error when the left-hand operand of a conditionally evaluating operation is not valid in a constexpr context. The following code compiles in Visual Studio 2015 but not in Visual Studio 2017 (C3615 constexpr function 'f' cannot result in a constant expression):
147
147
148
148
```cpp
149
149
template<int N>
@@ -154,7 +154,7 @@ struct array
154
154
155
155
constexprboolf(const array<1> &arr)
156
156
{
157
-
return arr.size() == 10 || arr.size() == 11; // error starting in Visual Studio 2017
To correct the error, either declare the array::size() function as constexpr or remove the constexpr qualifier from f.
@@ -372,8 +372,8 @@ Visual Studio 2017 Update Version 15.3 improves pre-condition checks for type-tr
372
372
struct S;
373
373
enum E;
374
374
375
-
static_assert(!__is_assignable(S, S), "fail"); // this is allowed in VS2017 RTM, but should fail
376
-
static_assert(__is_convertible_to(E, E), "fail"); // this is allowed in VS2017 RTM, but should fail
375
+
static_assert(!__is_assignable(S, S), "fail"); // C2139 in 15.3
376
+
static_assert(__is_convertible_to(E, E), "fail"); // C2139 in 15.3
377
377
```
378
378
379
379
### New compiler warning and runtime checks on native-to-managed marshaling
@@ -416,7 +416,7 @@ To fix the error, remove the `#pragma managed` directive to mark the caller as n
416
416
WinRT APIs that are released for experimentation and feedback will be decorated with `Windows.Foundation.Metadata.ExperimentalAttribute`. In Update Version 15.3, the compiler will produce warning C4698 when it encounters the attribute. A few APIs in previous versions of the Windows SDK have already been decorated with the attribute, and calls to these APIs will start triggering this compiler warning. Newer Windows SDKs will have the attribute removed from all shipped types, but if you are using an older SDK, you'll need to suppress these warnings for all calls to shipped types.
417
417
The following code produces warning C4698: "'Windows::Storage::IApplicationDataStatics2::GetForUserAsync' is for evaluation purposes only and is subject to change or removal in future updates":
Visual Studio 2017 RTW release had a regression in which the C++ compiler would not issue a diagnostic if a 'const' variable was not initialized. This regression has been fixed in Visual Studio 2017 Update 1. The following code now produces "warning C4132: 'Value': const object should be initialized":
565
565
566
566
```cpp
567
-
constint Value;
567
+
constint Value;//C4132
568
568
```
569
569
To fix the error, assign a value to `Value`.
570
570
@@ -649,7 +649,7 @@ void f()
649
649
using N::f;
650
650
651
651
S s1, s2;
652
-
f(s1, s2);
652
+
f(s1, s2); // C2668
653
653
}
654
654
```
655
655
To fix the code, remove the using N::f statement if you intended to call ::f().
@@ -664,7 +664,8 @@ void f(S, int);
664
664
665
665
void g()
666
666
{
667
-
void f(S); // or void f(S, int);
667
+
void f(S); // C2660 'f': function does not take 2 arguments:
0 commit comments