Skip to content

Commit dadf771

Browse files
authored
Tweak example in C4172 warning reference
1 parent 9bc3a15 commit dadf771

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4172.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ Redesign the function so that it does not return the address of a local object.
1818

1919
## Example
2020

21-
The following sample generates C4172:
21+
The following example generates C4172:
2222

2323
```cpp
2424
// C4172.cpp
25-
// compile with: /W1 /LD
26-
float f = 10;
27-
28-
const double& bar() {
29-
// try the following line instead
30-
// const float& bar() {
31-
return f; // C4172
25+
// compile with: /c /W1
26+
float f = 1.f;
27+
28+
const double& func()
29+
// Try one of the following lines instead:
30+
// const float& func()
31+
// const auto& func()
32+
{
33+
return f; // C4172
3234
}
3335
```

0 commit comments

Comments
 (0)