Skip to content

Commit 5be377a

Browse files
author
Colin Robertson
committed
Repair damaged file, remove more 2017 references
1 parent ca211b8 commit 5be377a

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

docs/TOC.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# [C++ in Visual Studio 2017](overview/visual-cpp-in-visual-studio.md)
1+
# [C++ in Visual Studio](overview/visual-cpp-in-visual-studio.md)
22
## [Overview of C++ development in Visual Studio](overview/overview-of-cpp-development.md)
3-
## [What's new for C++ in Visual Studio 2017](overview/what-s-new-for-visual-cpp-in-visual-studio.md)
4-
## [C++ conformance improvements in Visual Studio 2017](overview/cpp-conformance-improvements.md)
3+
## [What's new for C++ in Visual Studio](overview/what-s-new-for-visual-cpp-in-visual-studio.md)
4+
## [C++ conformance improvements in Visual Studio](overview/cpp-conformance-improvements.md)
55
## [Microsoft C++ language conformance](overview/visual-cpp-language-conformance.md)
66
## [Supported platforms](overview/supported-platforms-visual-cpp.md)
77
## [Visual C++ Tools and Features in Visual Studio Editions](overview/visual-cpp-tools-and-features-in-visual-studio-editions.md)

docs/overview/2017/cpp-conformance-improvements-2017.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,45 @@ void bar(A<0> *p)
330330

331331
[P0426R1](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0426r1.html) Changes to `std::traits_type` member functions `length`, `compare`, and `find` in order to make `std::string_view` usable in constant expressions. (In Visual Studio 2017 version 15.6, supported for Clang/LLVM only. In version 15.7 Preview 2, support is nearly complete for ClXX as well.)
332332

333+
## <a name="improvements_159"></a> Improvements in Visual Studio 2017 version 15.9
334+
335+
### Left-to-right evaluation order for operators ->*, [], >>, and <<
336+
337+
Starting in C++17, the operands of the operators ->*, [], >>, and \<\< must be evaluated in left-to-right order. There are two cases in which the compiler is unable to guarantee this order:
338+
- when one of the operand expressions is an object passed by value or contains an object passed by value, or
339+
- when compiled by using **/clr**, and one of the operands is a field of an object or an array element.
340+
341+
The compiler emits warning [C4866](https://docs.microsoft.com/cpp/error-messages/compiler-warnings/c4866?view=vs-2017) when it can't guarantee left-to-right evaluation. This warning is only generated if **/std:c++17** or later is specified, as the left-to-right order requirement of these operators was introduced in C++17.
342+
343+
To resolve this warning, first consider whether left-to-right evaluation of the operands is necessary, such as when evaluation of the operands might produce order-dependent side-effects. In many cases, the order in which operands are evaluated does not have an observable effect. If the order of evaluation must be left-to-right, consider whether you can pass the operands by const reference instead. This change eliminates the warning in the following code sample.
344+
345+
```cpp
346+
// C4866.cpp
347+
// compile with: /w14866 /std:c++17
348+
349+
class HasCopyConstructor
350+
{
351+
public:
352+
int x;
353+
354+
HasCopyConstructor(int x) : x(x) {}
355+
HasCopyConstructor(const HasCopyConstructor& h) : x(h.x) { }
356+
};
357+
358+
int operator>>(HasCopyConstructor a, HasCopyConstructor b) { return a.x >> b.x; }
359+
360+
// This version of operator>> does not trigger the warning:
361+
// int operator>>(const HasCopyConstructor& a, const HasCopyConstructor& b) { return a.x >> b.x; }
362+
363+
int main()
364+
{
365+
HasCopyConstructor a{ 1 };
366+
HasCopyConstructor b{ 2 };
367+
368+
a>>b; // C4866 for call to operator>>
369+
};
370+
```
371+
333372
## Bug fixes in Visual Studio versions 15.0, [15.3](#update_153), [15.5](#update_155), [15.7](#update_157), [15.8](#update_158), and [15.9](#update_159)
334373
335374
### Copy-list-initialization

0 commit comments

Comments
 (0)