Skip to content

Update C3551 #4755

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 1 commit into from
Oct 17, 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
22 changes: 13 additions & 9 deletions docs/error-messages/compiler-errors-2/compiler-error-c3551.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
---
description: "Learn more about: Compiler Error C3551"
title: "Compiler Error C3551"
ms.date: "11/04/2016"
ms.date: "10/07/2023"
f1_keywords: ["C3551"]
helpviewer_keywords: ["C3551"]
ms.assetid: c8ee23da-6568-40db-93a6-3ddb7ac47712
---
# Compiler Error C3551

"expected a late specified return type"
if a trailing return type is used then the leading return type shall be the single type-specifier 'auto' (not 'type')

If you use the **`auto`** keyword as a placeholder for the return type of a function, you must provide a late-specified return type. In the following example, the late-specified return type of function `myFunction` is a pointer to an array of four elements of type **`int`**.
The leading return type in [trailing return type](../../cpp/functions-cpp.md#trailing-return-types) syntax must contain only `auto`.

```
auto myFunction()->int(*)[4];
```
```cpp
// C3551.cpp
// compile with: /c
const auto func1() -> const int; // C3551
auto* func2() -> int*; // C3551
auto& func3() -> int&; // C3551
auto&& func4() -> int&&; // C3551
decltype(auto) func5() -> int; // C3551

## See also

[auto](../../cpp/auto-cpp.md)
auto func6() -> int; // OK
```