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

            Bug ID: 81636
           Summary: Confusing warning message containing "#‘obj_type_ref’
                    not supported by expression#"
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abbeyj+gcc at gmail dot com
  Target Milestone: ---

This occurs with any version of GCC that I've tried that recognizes -std=c++11.
 It seems to affect all versions v4.7.1 through v7.1 according to
https://gcc.godbolt.org/

Test case:
class C {
  virtual int MyVirtual();
  void Foo();
};

void C::Foo() {
  int x{ MyVirtual() / 2.0 };
}


$ g++-4.9.4 -std=c++11 -c test.cpp
test.cpp: In member function ‘void C::Foo()’:
test.cpp:7:22: warning: narrowing conversion of ‘((double)(#‘obj_type_ref’ not
supported by expression#)(this) / 2.0e+0)’ from ‘double’ to ‘int’ inside { }
[-Wnarrowing]
   int x{ MyVirtual() / 2.0 };
                      ^


I believe that GCC is correct to issue a warning here.  But the text of the
warning message is not friendly, especially the "#‘obj_type_ref’ not supported
by expression#" part.

Reply via email to