public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11616] New: Error message "instantiated from here" gives wrong location
@ 2003-07-21 16:31 reichelt at gcc dot gnu dot org
  2003-07-21 16:59 ` [Bug c++/11616] " bangerth at dealii dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-07-21 16:31 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-11-05 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-21 16:31 [Bug c++/11616] New: Error message "instantiated from here" gives wrong location reichelt at gcc dot gnu dot org
2003-07-21 16:59 ` [Bug c++/11616] " bangerth at dealii dot org
2003-08-05 19:10 ` pinskia at physics dot uc dot edu
2003-08-23  1:55 ` dhazeghi at yahoo dot com
2003-11-05 14:01 ` lerdsuwa at gcc dot gnu dot org
2003-11-05 14:38 ` cvs-commit at gcc dot gnu dot org
2003-11-05 14:38 ` lerdsuwa at gcc dot gnu dot org
2003-11-05 14:58 ` lerdsuwa at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).