Skip to content

Commit 873c692

Browse files
authored
Merge pull request MicrosoftDocs#4754 from Rageking8/add-example-to-c3550
Add example to C3550
2 parents 7cc6846 + 6c6c176 commit 873c692

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ 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+
decltype(auto)* func1(); // C3550
23+
decltype(auto)& func2(); // C3550
24+
decltype(auto)&& func3(); // C3550
25+
26+
auto* func4(); // OK
27+
```
28+
29+
To resolve the error remove all illegal qualification on `decltype(auto)`. For instance, `decltype(auto)* func1()` can be turned into `auto* func1()`.
1430
1531
## See also
1632

0 commit comments

Comments
 (0)