Skip to content

Commit 8d566a0

Browse files
authored
Add example to C3550
1 parent c192538 commit 8d566a0

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

docs/error-messages/compiler-errors-2/compiler-error-c3550.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,31 @@ ms.assetid: 9f2d5ffc-e429-41a1-89e3-7acc4fd47e14
1010

1111
only plain 'decltype(auto)' is allowed in this context
1212

13-
If `decltype(auto)` is used as a placeholder for the return type of a function, it must be used by itself. It cannot be used as part of a pointer declaration (`decltype(auto*)`), a reference declaration (`decltype(auto&)`), or any other such qualification.
13+
If [`decltype(auto)`](../../cpp/decltype-cpp.md#decltype-and-auto) is used as a placeholder for the return type of a function, it must be used by itself. It cannot be used as part of a pointer declaration (`decltype(auto)*`), a reference declaration (`decltype(auto)&`), or any other such qualification.
14+
15+
## Example
16+
17+
The following sample generates C3550:
18+
19+
```cpp
20+
// C3550.cpp
21+
// compile with: /c
22+
int dummy;
23+
24+
decltype(auto)* func1() { // C3550
25+
return &dummy;
26+
}
27+
28+
decltype(auto)& func2() { // C3550
29+
return dummy;
30+
}
31+
32+
decltype(auto)&& func3() { // C3550
33+
return 123;
34+
}
35+
```
36+
37+
To resolve the error remove all illegal qualification on `decltype(auto)`.
1438
1539
## See also
1640

0 commit comments

Comments
 (0)