[Bug c++/91112] New: Bad error message for virtual function of a template class. Wrong "required from here" line number

2019-07-08 Thread ivan.kharpalev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91112

Bug ID: 91112
   Summary: Bad error message for virtual function of a template
class. Wrong "required from here" line number
   Product: gcc
   Version: 8.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ivan.kharpalev at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/orxMIj
I expect to see number of the line that triggers instantiation.
gcc-7 and clang show it.


P.S.
It even does not show bad method invocation line if it was called via base
class pointer.
https://godbolt.org/z/-SN5n5

It only shows call line for the class itself
https://godbolt.org/z/kmaUQt

[Bug c++/91112] [8 Regression] Bad error message for virtual function of a template class. Wrong "required from here" line number

2019-07-11 Thread ivan.kharpalev at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91112

--- Comment #2 from Харпалёв Иван  ---
(In reply to Jonathan Wakely from comment #1)
> Please provide the code, not URLs (as https://gcc.gnu.org/bugs/ requests).

gcc-8 shows bad  "required from here" line number in error message when
compiles this:

template 
struct A {
virtual void unused() {
return T::foo();
}
};

int main() {
A a;
}



P.S.
And a relevant observation (see comments in main):

struct B{
virtual void f() = 0;
};

template 
struct A : public B {
virtual void f() override {
return T::foo();
}
};

int main() {
A a;
// a.f(); // error message for this line is OK
static_cast(a).f(); // bad "required from here" in error message
}