public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97772] New: Wording of GCC's error message when calling lvalue-ref qualified member function on temporary object
@ 2020-11-10  6:12 enricomaria.dean6elis at gmail dot com
  2020-11-19 18:44 ` [Bug c++/97772] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2020-11-10  6:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97772
           Summary: Wording of GCC's error message when calling lvalue-ref
                    qualified member function on temporary object
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: enricomaria.dean6elis at gmail dot com
  Target Milestone: ---

Long story short, write this source file

struct A {
    void doWork() & {}
};
int main() {
    A{}.doWork();
}

compile it with

g++ -std=c++17 that_file.cpp

and the error will be

error: passing ‘A’ as ‘this’ argument discards qualifiers [-fpermissive]

There's really no discarded qualifier; it's just that `A{}` cannot bind to the
`&`-qualified overload.

The full discussion is on StackOverflow at
https://stackoverflow.com/q/64705932/5825294

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/97772] Wording of GCC's error message when calling lvalue-ref qualified member function on temporary object
  2020-11-10  6:12 [Bug c++/97772] New: Wording of GCC's error message when calling lvalue-ref qualified member function on temporary object enricomaria.dean6elis at gmail dot com
@ 2020-11-19 18:44 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-11-19 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-11-19
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed as a diagnostic improvement.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-19 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  6:12 [Bug c++/97772] New: Wording of GCC's error message when calling lvalue-ref qualified member function on temporary object enricomaria.dean6elis at gmail dot com
2020-11-19 18:44 ` [Bug c++/97772] " mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).