https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88577

            Bug ID: 88577
           Summary: misleading error message with template and auto return
                    type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.campredon at gmail dot com
  Target Milestone: ---

For the following code
----------------
template <int> struct s{}

auto f() {}
----------------
g++ produces a rather misleading error message:

<source>:3:1: error: multiple types in one declaration
    3 | auto f() {}
      | ^~~~
<source>:3:5: error: expected ';' before 'f'
    3 | auto f() {}
      |     ^~
      |     ;

If the template is removed, or the return type is changed the compiler suggest
the good place for the missing semi colon.

Reply via email to