Skip to content

Commit 332074a

Browse files
authored
Update compiler-warning-level-2-c4150.md
1 parent 0e4accc commit 332074a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-2-c4150.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ helpviewer_keywords: ["C4150"]
99

1010
> deletion of pointer to incomplete type 'type'; no destructor called
1111
12-
The `delete` operator is called to delete a type that was declared but not defined. The compiler can't find the destructor to call because the definition isn't in the same translation unit as the `delete`. The pattern of declaring a class without defining is sometimes used to reduce the number of `#include` directives in order to speed up the build.
12+
The `delete` operator is called to delete a type that was declared but not defined. The compiler can't find the destructor to call because the definition isn't in the same translation unit as the `delete`.
1313

1414
The following sample generates C4150 by declaring but not defining `class IncClass`:
1515

@@ -23,7 +23,7 @@ void NoDestruct( IncClass* pIncClass )
2323
}
2424
```
2525
26-
This issue should be fixed by putting the definition for the `IncClass` type in the same translation unit as the `delete`. If the class is declared in a header file, it can be included in the translation unit. If the class isn't declared in a header file, the `NoDestruct` definition may need to be moved into the same file as the `IncClass` definition.
26+
To fix the issue, put the definition of `IncClass` in the same translation unit or file as the `delete`. If the class is declared in a header file, it can be included in the translation unit. If the class isn't declared in a header file, the `NoDestruct` definition may need to be moved into the same file as the `IncClass` definition.
2727
2828
```cpp
2929
// compile with: /W2
@@ -35,12 +35,12 @@ void NoDestruct( IncClass* pIncClass )
3535
}
3636
```
3737

38-
C4150 can also occur when the class is defined after the destructor call in the same translation unit. For example:
38+
C4150 can also occur when the class is defined after the destructor call in the same translation unit. In the following example `IncClass` is declared before it is used, but not defined until after:
3939

4040
```cpp
4141
// C4150.cpp
4242
// compile with: /W2
43-
class IncClass;
43+
class IncClass;
4444

4545
void NoDestruct( IncClass* pIncClass )
4646
{

0 commit comments

Comments
 (0)