Skip to content

Add example to C3550 #4754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/error-messages/compiler-errors-2/compiler-error-c3550.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,23 @@ ms.assetid: 9f2d5ffc-e429-41a1-89e3-7acc4fd47e14

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

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.
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.

## Example

The following sample generates C3550:

```cpp
// C3550.cpp
// compile with: /c
decltype(auto)* func1(); // C3550
decltype(auto)& func2(); // C3550
decltype(auto)&& func3(); // C3550

auto* func4(); // OK
```

To resolve the error remove all illegal qualification on `decltype(auto)`. For instance, `decltype(auto)* func1()` can be turned into `auto* func1()`.

## See also

Expand Down