This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/81099] New: A single `decltype(this)` at top level triggers 2 identical error messages


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;
              ^~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]