Skip to content

Commit edef397

Browse files
committed
Expand example in /permissive- per VCSig
1 parent e3bd2c8 commit edef397

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

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

Lines changed: 15 additions & 3 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
@@ -54,25 +54,37 @@ void func(int default); // Error C2321: 'default' is a keyword, and
5454
template <typename T>
5555
struct B {
5656
void f();
57+
template <typename U>
58+
struct S {};
5759
};
5860
5961
template <typename T>
6062
struct D : public B<T> // B is a dependent base because its type
6163
// depends on the type of T.
6264
{
63-
// One possible fix is to uncomment the following line.
64-
// If this is a type, don't forget the 'typename' keyword.
65+
// One possible fix for member functions is to uncomment
66+
// the following line:
6567
// using B<T>::f;
68+
// If it's a type, don't forget the 'typename' keyword.
6669
6770
void g() {
6871
f(); // error C3861: 'f': identifier not found
6972
// Another fix is to change it to 'this->f();'
7073
}
74+
75+
void h() {
76+
S<int> s; // C2065 'S': undeclared identifier
77+
// Since template S is dependent, D::template S isn't enough.
78+
// The type must be qualified with the `typename` keyword.
79+
// To fix, replace the above with this uncommented line:
80+
// typename D::template S<int> s;
81+
}
7182
};
7283
7384
void h() {
7485
D<int> d;
7586
d.g();
87+
d.h();
7688
}
7789
```
7890

0 commit comments

Comments
 (0)