This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11616] New: Error message "instantiated from here" gives wrong location
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jul 2003 16:31:17 -0000
- Subject: [Bug c++/11616] New: Error message "instantiated from here" gives wrong location
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11616
Summary: Error message "instantiated from here" gives wrong
location
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
Consider the following invalid code:
----------------------------------------------
1 template <int> struct A
2 {
3 static const int i=0;
4 };
5
6 int baz() { return A<0>::i; }
7
8 struct B
9 {
10 static void foo (int);
11 };
12
13 template <typename T> struct C
14 {
15 virtual void bar() const { T::foo(); }
16 };
17
18 C<B> c;
----------------------------------------------
Compiling this with g++ gives the following error message:
file.cc: In member function `void C<T>::bar() const [with T = B]':
file.cc:6: instantiated from here
file.cc:15: error: no matching function for call to `B::foo()'
file.cc:10: note: candidates are: static void B::foo(int)
The line number "6" in line 2 of the error message is obviously bogus.
It should read "18" instead.
The bug happened to me in a more complex situation where even the
file name was wrong. In such a case it is very difficult to find the
point of instantiation by hand. :-(
All versions since 2.95.x seem to be affected (including 3.3 branch and
mainline).