Skip to content

Commit 54a00a7

Browse files
authored
Merge pull request #4745 from MicrosoftDocs/main
1/12 AM Publish
2 parents 1a2f6cf + adbd15d commit 54a00a7

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

docs/build/reference/permissive-standards-conformance.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "/permissive- (Standards conformance)"
33
description: "Reference guide to the Microsoft C++ /permissive- (Standards conformance) compiler option."
4-
ms.date: 06/29/2022
4+
ms.date: 12/14/2022
55
f1_keywords: ["/permissive", "VC.Project.VCCLCompilerTool.ConformanceMode"]
66
helpviewer_keywords: ["/permissive compiler options [C++]", "-permissive compiler options [C++]", "Standards conformance compiler options", "permissive compiler options [C++]"]
77
ms.assetid: db1cc175-6e93-4a2e-9396-c3725d2d8f71
@@ -52,27 +52,45 @@ void func(int default); // Error C2321: 'default' is a keyword, and
5252
5353
```cpp
5454
template <typename T>
55-
struct B {
56-
void f();
55+
struct B
56+
{
57+
void f() {}
58+
template <typename U>
59+
struct S { void operator()(){ return; } };
5760
};
5861
5962
template <typename T>
6063
struct D : public B<T> // B is a dependent base because its type
6164
// depends on the type of T.
6265
{
63-
// One possible fix is to uncomment the following line.
64-
// If this is a type, don't forget the 'typename' keyword.
66+
// One possible fix for non-template members and function
67+
// template members is a using statement:
6568
// using B<T>::f;
69+
// If it's a type, don't forget the 'typename' keyword.
6670
67-
void g() {
71+
void g()
72+
{
6873
f(); // error C3861: 'f': identifier not found
69-
// Another fix is to change it to 'this->f();'
74+
// Another fix is to change the call to 'this->f();'
75+
}
76+
77+
void h()
78+
{
79+
S<int> s; // C2065 or C3878
80+
// Since template S is dependent, the type must be qualified
81+
// with the `typename` keyword.
82+
// To fix, replace the declaration of s with:
83+
// typename B<T>::template S<int> s;
84+
// Or, use this:
85+
// typename D::template S<int> s;
86+
s();
7087
}
7188
};
7289
7390
void h() {
7491
D<int> d;
7592
d.g();
93+
d.h();
7694
}
7795
```
7896

0 commit comments

Comments
 (0)