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

            Bug ID: 90767
           Summary: jumbled error message with this and const
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

struct x {
  int n;
  void bye();

  template<typename T>
  operator T() const
    {
      if (n == 0)
        bye();
      return n;
    }
};

$ ./cc1plus -quiet f.cc
f.cc: In member function ‘x::operator T() const’:
f.cc:9:6: error: cannot convert ‘#‘addr_expr’ not supported by dump_type#<type
error>’ to ‘x*’
    9 |  bye();
      |      ^
f.cc:3:8: note:   initializing argument 'this' of ‘void x::bye()’
    3 |   void bye();
      |        ^~~

whereas g++ 8 gave:
f.cc: In member function ‘x::operator T() const’:
f.cc:9:6: error: no matching function for call to ‘x::bye() const’
  bye();
      ^
f.cc:3:8: note: candidate: ‘void x::bye()’ <near match>
   void bye();
        ^~~
f.cc:3:8: note:   passing ‘const x*’ as ‘this’ argument discards qualifiers

Reply via email to