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

            Bug ID: 81099
           Summary: A single `decltype(this)` at top level triggers 2
                    identical error messages
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamsupermouse at mail dot ru
  Target Milestone: ---

If `decltype(this)` is used at top level, it triggers *two* identical error
messages. For example:

    using T = decltype(this);

Results in:

    <source>:1:20: error: invalid use of 'this' at top level
     using T = decltype(this);
                        ^~~~
    <source>:1:20: error: invalid use of 'this' at top level


On the other hand, following:

    auto x = this;
    // al well as `using T = decltype(*this);`

triggers a *single* error message:

    <source>:1:10: error: invalid use of 'this' at top level
     auto x = this;
              ^~~~

Reply via email to