Skip to content

Commit f1b051a

Browse files
authored
Merge pull request #1004 from MicrosoftDocs/master
6/27 AM Publish
2 parents 1ac8f98 + 6e51240 commit f1b051a

File tree

326 files changed

+16880
-25855
lines changed

Some content is hidden

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

326 files changed

+16880
-25855
lines changed

.openpublishing.redirection.json

Lines changed: 555 additions & 0 deletions
Large diffs are not rendered by default.

docs/build/msbuild-visual-cpp-overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ The following table lists several useful user-oriented targets.
129129
|Rebuild|Cleans and then builds your project.|
130130
|ResourceCompile|Executes the Microsoft Windows Resource Compiler tool, rc.exe.|
131131
|XdcMake|Executes the XML Documentation tool, xdcmake.exe.|
132-
|Xsd|Executes the XML Schema Definition tool, xsd.exe.|
132+
|Xsd|Executes the XML Schema Definition tool, xsd.exe. *See note below.*|
133+
134+
> [!NOTE]
135+
> In Visual Studio 2017, C++ project support for **xsd** files is deprecated. You can still use **Microsoft.VisualC.CppCodeProvider** by adding **CppCodeProvider.dll** manually to the GAC.
133136
134137
## See Also
135138

docs/build/walkthrough-using-msbuild-to-create-a-visual-cpp-project.md

Lines changed: 259 additions & 245 deletions
Large diffs are not rendered by default.

docs/cpp-conformance-improvements-2017.md

Lines changed: 207 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ author: "mikeblome"
99
ms.author: "mblome"
1010
ms.workload: ["cplusplus"]
1111
---
12-
# C++ conformance improvements in Visual Studio 2017 versions 15.0, [15.3](#improvements_153), [15.5](#improvements_155), [15.6](#improvements_156), and [15.7](#improvements_157)
12+
# C++ conformance improvements in Visual Studio 2017 versions 15.0, [15.3](#improvements_153), [15.5](#improvements_155), [15.6](#improvements_156), [15.7](#improvements_157)
1313

1414
With support for generalized constexpr and NSDMI for aggregates, the Microsoft Visual C++ compiler is now complete for features added in the C++14 Standard. Note that the compiler still lacks a few features from the C++11 and C++98 Standards. See [Visual C++ Language Conformance](visual-cpp-language-conformance.md) for a table that shows the current state of the compiler.
1515

@@ -331,7 +331,7 @@ void bar(A<0> *p)
331331

332332
[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 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.)
333333

334-
## Bug fixes in Visual Studio versions 15.0, [15.3](#update_153), [15.5](#update_155), and [15.7](#update_157)
334+
## Bug fixes in Visual Studio versions 15.0, [15.3](#update_153), [15.5](#update_155), [15.7](#update_157), and [15.8](#update_158)
335335

336336
### Copy-list-initialization
337337

@@ -1615,6 +1615,211 @@ int main() {
16151615
16161616
```
16171617

1618+
## <a name="update_158"></a> Bug fixes and behavior changes in Visual Studio 2017 version 15.8
1619+
1620+
### typename on unqualified identifiers
1621+
1622+
In [/permissive-](build/reference/permissive-standards-conformance.md) mode, spurious `typename` keywords on unqualified identifiers in alias template definitions are no longer accepted by the compiler. The following code now produces C7511 *'T': 'typename' keyword must be followed by a qualified name*:
1623+
1624+
```cpp
1625+
template <typename T>
1626+
using X = typename T;
1627+
```
1628+
1629+
To fix the error, simply change the second line to `using X = T;`.
1630+
1631+
### __declspec() on right side of alias template definitions
1632+
1633+
[__declspec](cpp/declspec.md) is no longer permitted on the right-hand-side of an alias template definition. This was previously accepted by the compiler but was completely ignored, and would never result in a deprecation warning when the alias was used.
1634+
1635+
The standard C++ attribute [\[\[deprecated\]\]](cpp/attributes.md) may be used instead, and will be respected as of Visual Studio 2017 version 15.6. The following code now produces C2760 *syntax error: unexpected token '__declspec', expected 'type specifier'*:
1636+
1637+
```cpp
1638+
template <typename T>
1639+
using X = __declspec(deprecated("msg")) T;
1640+
```
1641+
1642+
To fix the error, change to code to the following (with the attribute placed before the '=' of the alias definition):
1643+
1644+
```cpp
1645+
template <typename T>
1646+
using X [[deprecated("msg")]] = T;
1647+
```
1648+
1649+
### Two-phase name lookup diagnostics
1650+
1651+
Two-phase name lookup requires that non-dependent names used in template bodies must be visible to the template at definition time. Previously, the Microsoft C++ compiler would leave an unfound name un-looked-up until instantiation times. Now, it requires that non-dependent names are bound in the template body.
1652+
1653+
One way this can manifest is with lookup into dependent base classes. Previously, the compiler allowed the use of names that are defined in dependent base classes because they would be looked up during instantiation time when all the types are resolved. Now that code it is treated as an error. In these cases you can force the variable to be looked up at instantiation time by qualifying it with the base class type or otherwise making it dependent, for example by adding a `this->` pointer.
1654+
1655+
In **/permissive-** mode, the following code now raises C3861: *'base_value': identifier not found*:
1656+
1657+
```cpp
1658+
template <class T>
1659+
struct Base {
1660+
int base_value = 42;
1661+
};
1662+
1663+
template <class T>
1664+
struct S : Base<T> {
1665+
int f() {
1666+
return base_value;
1667+
}
1668+
};
1669+
1670+
```
1671+
1672+
To fix the error, change the `return` statement to `return this->base_value;`.
1673+
1674+
### forward declarations and definitions in namespace std
1675+
1676+
The C++ standard doesn't allow a user to add forward declarations or definitions into namespace `std`. Adding declarations or definitions to namespace `std` or to a namespace within namespace std now results in undefined behavior.
1677+
1678+
At some time in the future, Microsoft will move the location where some STL types are defined. When this happens, it will break existing code that adds forward declarations to namespace `std`. A new warning, C4643, helps identify such source issues. The warning is enabled in **/default** mode and is off by default. It will impact programs that are compiled with **/Wall** or **/WX**.
1679+
1680+
The following code now raises C4643: *Forward declaring 'vector' in namespace std is not permitted by the C++ Standard*.
1681+
1682+
1683+
```cpp
1684+
namespace std {
1685+
template<typename T> class vector;
1686+
}
1687+
```
1688+
1689+
To fix the error, use an **include** directive rather than a forward declaration:
1690+
1691+
```cpp
1692+
#include <vector>
1693+
```
1694+
1695+
### Constructors that delegate to themselves
1696+
1697+
The C++ Standard suggests that a compiler should emit a diagnostic when a delegating constructor delegates to itself. The Microsoft C++ compiler in [/std:c++17](build/reference/std-specify-language-standard-version.md) and [/std:c++latest](build/reference/std-specify-language-standard-version.md) modes now raises C7535: *'X::X': delegating constructor calls itself*.
1698+
1699+
Without this error, the following program will compile but will generate an infinite loop:
1700+
1701+
```cpp
1702+
class X {
1703+
public:
1704+
X(int, int);
1705+
X(int v) : X(v){}
1706+
};
1707+
```
1708+
1709+
To avoid the infinite loop, delegate to a different constructor:
1710+
1711+
```cpp
1712+
class X {
1713+
public:
1714+
1715+
X(int, int);
1716+
X(int v) : X(v, 0) {}
1717+
};
1718+
```
1719+
1720+
### offsetof with constant expressions
1721+
1722+
[offsetof](c-runtime-library/reference/offsetof-macro.md) has traditionally been implemented using a macro that requires a [reinterpret_cast](cpp/reinterpret-cast-operator.md). This is illegal in contexts that require a constant expression, but the Microsoft C++ compiler has traditionally allowed it. The offsetof macro that is shipped as part of the STL correctly uses a compiler intrinsic (**__builtin_offsetof**), but many people have used the macro trick to define their own **offsetof**.
1723+
1724+
In Visual Studio 2017 version 15.8, the compiler constrains the areas that these reinterpret_casts can appear in the default mode in order to help code conform to standard C++ behavior. Under [/permissive-](build/reference/permissive-standards-conformance.md), the constraints are even stricter. Using the result of an offsetof in places that require constant expressions may result in code that issues warning C4644 *usage of the macro-based offsetof pattern in constant expressions is non-standard; use offsetof defined in the C++ standard library instead* or C2975 *invalid template argument, expected compile-time constant expression*.
1725+
1726+
The following code raises C4644 in **/default** and **/std:c++17** modes, and C2975 in **/permissive-** mode:
1727+
1728+
```cpp
1729+
struct Data {
1730+
int x;
1731+
};
1732+
1733+
// Common pattern of user-defined offsetof
1734+
#define MY_OFFSET(T, m) (unsigned long long)(&(((T*)nullptr)->m))
1735+
1736+
int main()
1737+
1738+
{
1739+
switch (0) {
1740+
case MY_OFFSET(Data, x): return 0;
1741+
default: return 1;
1742+
}
1743+
}
1744+
```
1745+
1746+
To fix the error, use **offsetof** as defined via \<cstddef>:
1747+
1748+
```cpp
1749+
#include <cstddef>
1750+
1751+
struct Data {
1752+
int x;
1753+
};
1754+
1755+
int main()
1756+
{
1757+
switch (0) {
1758+
case offsetof(Data, x): return 0;
1759+
default: return 1;
1760+
}
1761+
}
1762+
```
1763+
1764+
1765+
### cv-qualifiers on base classes subject to pack expansion
1766+
1767+
Previous versions of the Microsoft C++ compiler did not detect that a base-class had cv-qualifiers if it was also subject to pack expansion.
1768+
1769+
In Visual Studio 2017 version 15.8, in **/permissive-** mode the following code raises C3770 *'const S': is not a valid base class*:
1770+
1771+
```cpp
1772+
template<typename... T>
1773+
class X : public T... { };
1774+
1775+
class S { };
1776+
1777+
int main()
1778+
{
1779+
X<const S> x;
1780+
}
1781+
```
1782+
### template keyword and nested-name-specifiers
1783+
1784+
In **/permissive-** mode, the compiler now requires the `template` keyword to precede a template-name when it comes after a nested-name-specifier which is dependent.
1785+
1786+
The following code in **/permissive-** mode now raises C7510: *'foo': use of dependent template name must be prefixed with 'template'. note: see reference to class template instantiation 'X<T>' being compiled*:
1787+
1788+
```cpp
1789+
template<typename T> struct Base
1790+
{
1791+
template<class U> void foo() {}
1792+
};
1793+
1794+
template<typename T>
1795+
struct X : Base<T>
1796+
{
1797+
void foo()
1798+
{
1799+
Base<T>::foo<int>();
1800+
}
1801+
};
1802+
```
1803+
1804+
To fix the error, add the `template` keyword to the `Base<T>::foo<int>();` statement, as shown in the following example:
1805+
1806+
```cpp
1807+
template<typename T> struct Base
1808+
{
1809+
template<class U> void foo() {}
1810+
};
1811+
1812+
template<typename T>
1813+
struct X : Base<T>
1814+
{
1815+
void foo()
1816+
{
1817+
// Add template keyword here:
1818+
Base<T>::template foo<int>();
1819+
}
1820+
};
1821+
```
1822+
16181823
## See also
16191824

16201825
[Visual C++ Language Conformance](visual-cpp-language-conformance.md)

docs/dotnet/TOC.md

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -181,33 +181,6 @@
181181
#### [How to: Iterate Over a Generic Collection with for each](how-to-iterate-over-a-generic-collection-with-for-each.md)
182182
#### [How to: Iterate Over a User-Defined Collection with for each](how-to-iterate-over-a-user-defined-collection-with-for-each.md)
183183
### [functional (STL/CLR)](functional-stl-clr.md)
184-
#### [binary_delegate (STL/CLR)](binary-delegate-stl-clr.md)
185-
#### [binary_delegate_noreturn (STL/CLR)](binary-delegate-noreturn-stl-clr.md)
186-
#### [binary_negate (STL/CLR)](binary-negate-stl-clr.md)
187-
#### [bind1st (STL/CLR)](bind1st-stl-clr.md)
188-
#### [bind2nd (STL/CLR)](bind2nd-stl-clr.md)
189-
#### [binder1st (STL/CLR)](binder1st-stl-clr.md)
190-
#### [binder2nd (STL/CLR)](binder2nd-stl-clr.md)
191-
#### [divides (STL/CLR)](divides-stl-clr.md)
192-
#### [equal_to (STL/CLR)](equal-to-stl-clr.md)
193-
#### [greater (STL/CLR)](greater-stl-clr.md)
194-
#### [greater_equal (STL/CLR)](greater-equal-stl-clr.md)
195-
#### [less (STL/CLR)](less-stl-clr.md)
196-
#### [less_equal (STL/CLR)](less-equal-stl-clr.md)
197-
#### [logical_and (STL/CLR)](logical-and-stl-clr.md)
198-
#### [logical_not (STL/CLR)](logical-not-stl-clr.md)
199-
#### [logical_or (STL/CLR)](logical-or-stl-clr.md)
200-
#### [minus (STL/CLR)](minus-stl-clr.md)
201-
#### [modulus (STL/CLR)](modulus-stl-clr.md)
202-
#### [multiplies (STL/CLR)](multiplies-stl-clr.md)
203-
#### [negate (STL/CLR)](negate-stl-clr.md)
204-
#### [not_equal_to (STL/CLR)](not-equal-to-stl-clr.md)
205-
#### [not1 (STL/CLR)](not1-stl-clr.md)
206-
#### [not2 (STL/CLR)](not2-stl-clr.md)
207-
#### [plus (STL/CLR)](plus-stl-clr.md)
208-
#### [unary_delegate (STL/CLR)](unary-delegate-stl-clr.md)
209-
#### [unary_delegate_noreturn (STL/CLR)](unary-delegate-noreturn-stl-clr.md)
210-
#### [unary_negate (STL/CLR)](unary-negate-stl-clr.md)
211184
### [hash_map (STL/CLR)](hash-map-stl-clr.md)
212185
### [hash_multimap (STL/CLR)](hash-multimap-stl-clr.md)
213186
### [hash_multiset (STL/CLR)](hash-multiset-stl-clr.md)
@@ -221,92 +194,8 @@
221194
### [queue (STL/CLR)](queue-stl-clr.md)
222195
### [set (STL/CLR)](set-stl-clr.md)
223196
### [stack (STL/CLR)](stack-stl-clr.md)
224-
#### [operator!= (stack) (STL/CLR)](operator-inequality-stack-stl-clr.md)
225-
#### [operator< (stack) (STL/CLR)](operator-less-than-stack-stl-clr.md)
226-
#### [operator<= (stack) (STL/CLR)](operator-less-or-equal-stack-stl-clr.md)
227-
#### [operator== (stack) (STL/CLR)](operator-equality-stack-stl-clr.md)
228-
#### [operator> (stack) (STL/CLR)](operator-greater-than-stack-stl-clr.md)
229-
#### [operator>= (stack) (STL/CLR)](operator-greater-or-equal-stack-stl-clr.md)
230-
#### [stack::assign (STL/CLR)](stack-assign-stl-clr.md)
231-
#### [stack::const_reference (STL/CLR)](stack-const-reference-stl-clr.md)
232-
#### [stack::container_type (STL/CLR)](stack-container-type-stl-clr.md)
233-
#### [stack::difference_type (STL/CLR)](stack-difference-type-stl-clr.md)
234-
#### [stack::empty (STL/CLR)](stack-empty-stl-clr.md)
235-
#### [stack::generic_container (STL/CLR)](stack-generic-container-stl-clr.md)
236-
#### [stack::generic_value (STL/CLR)](stack-generic-value-stl-clr.md)
237-
#### [stack::get_container (STL/CLR)](stack-get-container-stl-clr.md)
238-
#### [stack::operator= (STL/CLR)](stack-operator-assign-stl-clr.md)
239-
#### [stack::pop (STL/CLR)](stack-pop-stl-clr.md)
240-
#### [stack::push (STL/CLR)](stack-push-stl-clr.md)
241-
#### [stack::reference (STL/CLR)](stack-reference-stl-clr.md)
242-
#### [stack::size (STL/CLR)](stack-size-stl-clr.md)
243-
#### [stack::size_type (STL/CLR)](stack-size-type-stl-clr.md)
244-
#### [stack::stack (STL/CLR)](stack-stack-stl-clr.md)
245-
#### [stack::to_array (STL/CLR)](stack-to-array-stl-clr.md)
246-
#### [stack::top (STL/CLR)](stack-top-stl-clr.md)
247-
#### [stack::top_item (STL/CLR)](stack-top-item-stl-clr.md)
248-
#### [stack::value_type (STL/CLR)](stack-value-type-stl-clr.md)
249197
### [utility (STL/CLR)](utility-stl-clr.md)
250-
#### [make_pair (STL/CLR)](make-pair-stl-clr.md)
251-
#### [operator!= (pair) (STL/CLR)](operator-inequality-pair-stl-clr.md)
252-
#### [operator< (pair) (STL/CLR)](operator-less-than-pair-stl-clr.md)
253-
#### [operator<= (pair) (STL/CLR)](operator-less-or-equal-pair-stl-clr.md)
254-
#### [operator== (pair) (STL/CLR)](operator-equality-pair-stl-clr.md)
255-
#### [operator> (pair) (STL/CLR)](operator-greater-than-pair-stl-clr.md)
256-
#### [operator>= (pair) (STL/CLR)](operator-greater-or-equal-pair-stl-clr.md)
257-
#### [pair (STL/CLR)](pair-stl-clr.md)
258-
#### [pair::first (STL/CLR)](pair-first-stl-clr.md)
259-
#### [pair::first_type (STL/CLR)](pair-first-type-stl-clr.md)
260-
#### [pair::operator= (STL/CLR)](pair-operator-assign-stl-clr.md)
261-
#### [pair::pair (STL/CLR)](pair-pair-stl-clr.md)
262-
#### [pair::second (STL/CLR)](pair-second-stl-clr.md)
263-
#### [pair::second_type (STL/CLR)](pair-second-type-stl-clr.md)
264-
#### [pair::swap (STL/CLR)](pair-swap-stl-clr.md)
265198
### [vector (STL/CLR)](vector-stl-clr.md)
266-
#### [operator!= (vector) (STL/CLR)](operator-inequality-vector-stl-clr.md)
267-
#### [operator< (vector) (STL/CLR)](operator-less-than-vector-stl-clr.md)
268-
#### [operator<= (vector) (STL/CLR)](operator-less-or-equal-vector-stl-clr.md)
269-
#### [operator== (vector) (STL/CLR)](operator-equality-vector-stl-clr.md)
270-
#### [operator> (vector) (STL/CLR)](operator-greater-than-vector-stl-clr.md)
271-
#### [operator>= (vector) (STL/CLR)](operator-greater-or-equal-vector-stl-clr.md)
272-
#### [vector::assign (STL/CLR)](vector-assign-stl-clr.md)
273-
#### [vector::at (STL/CLR)](vector-at-stl-clr.md)
274-
#### [vector::back (STL/CLR)](vector-back-stl-clr.md)
275-
#### [vector::back_item (STL/CLR)](vector-back-item-stl-clr.md)
276-
#### [vector::begin (STL/CLR)](vector-begin-stl-clr.md)
277-
#### [vector::capacity (STL/CLR)](vector-capacity-stl-clr.md)
278-
#### [vector::clear (STL/CLR)](vector-clear-stl-clr.md)
279-
#### [vector::const_iterator (STL/CLR)](vector-const-iterator-stl-clr.md)
280-
#### [vector::const_reference (STL/CLR)](vector-const-reference-stl-clr.md)
281-
#### [vector::const_reverse_iterator (STL/CLR)](vector-const-reverse-iterator-stl-clr.md)
282-
#### [vector::difference_type (STL/CLR)](vector-difference-type-stl-clr.md)
283-
#### [vector::empty (STL/CLR)](vector-empty-stl-clr.md)
284-
#### [vector::end (STL/CLR)](vector-end-stl-clr.md)
285-
#### [vector::erase (STL/CLR)](vector-erase-stl-clr.md)
286-
#### [vector::front (STL/CLR)](vector-front-stl-clr.md)
287-
#### [vector::front_item (STL/CLR)](vector-front-item-stl-clr.md)
288-
#### [vector::generic_container (STL/CLR)](vector-generic-container-stl-clr.md)
289-
#### [vector::generic_iterator (STL/CLR)](vector-generic-iterator-stl-clr.md)
290-
#### [vector::generic_reverse_iterator (STL/CLR)](vector-generic-reverse-iterator-stl-clr.md)
291-
#### [vector::generic_value (STL/CLR)](vector-generic-value-stl-clr.md)
292-
#### [vector::insert (STL/CLR)](vector-insert-stl-clr.md)
293-
#### [vector::iterator (STL/CLR)](vector-iterator-stl-clr.md)
294-
#### [vector::operator= (STL/CLR)](vector-operator-assign-stl-clr.md)
295-
#### [vector::operator(STL/CLR)](vector-operator-stl-clr.md)
296-
#### [vector::pop_back (STL/CLR)](vector-pop-back-stl-clr.md)
297-
#### [vector::push_back (STL/CLR)](vector-push-back-stl-clr.md)
298-
#### [vector::rbegin (STL/CLR)](vector-rbegin-stl-clr.md)
299-
#### [vector::reference (STL/CLR)](vector-reference-stl-clr.md)
300-
#### [vector::rend (STL/CLR)](vector-rend-stl-clr.md)
301-
#### [vector::reserve (STL/CLR)](vector-reserve-stl-clr.md)
302-
#### [vector::resize (STL/CLR)](vector-resize-stl-clr.md)
303-
#### [vector::reverse_iterator (STL/CLR)](vector-reverse-iterator-stl-clr.md)
304-
#### [vector::size (STL/CLR)](vector-size-stl-clr.md)
305-
#### [vector::size_type (STL/CLR)](vector-size-type-stl-clr.md)
306-
#### [vector::swap (STL/CLR)](vector-swap-stl-clr.md)
307-
#### [vector::to_array (STL/CLR)](vector-to-array-stl-clr.md)
308-
#### [vector::value_type (STL/CLR)](vector-value-type-stl-clr.md)
309-
#### [vector::vector (STL/CLR)](vector-vector-stl-clr.md)
310199
## [C++ Support Library](cpp-support-library.md)
311200
### [Overview of Marshaling in C++](overview-of-marshaling-in-cpp.md)
312201
#### [marshal_as](marshal-as.md)

0 commit comments

Comments
 (0)