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

--- Comment #2 from Харпалёв Иван <ivan.kharpalev at gmail dot com> ---
(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 <class T>
struct A {
    virtual void unused() {
        return T::foo();
    }
};

int main() {
    A<int> a;
}



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

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

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

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

Reply via email to