re PR c++/11616 (Error message "instantiated from here" gives wrong location)

PR c++/11616
	* pt.c (instantiate_pending_templates): Save and restore
	input_location.

	* g++.dg/template/instantiate5.C: New test.

From-SVN: r73269
This commit is contained in:
Kriang Lerdsuwanakij 2003-11-05 14:37:57 +00:00 committed by Kriang Lerdsuwanakij
parent 437a91e664
commit aad626f71c
4 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11616
* pt.c (instantiate_pending_templates): Save and restore
input_location.
2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/2019

View File

@ -11037,6 +11037,7 @@ instantiate_pending_templates (void)
tree last = NULL_TREE;
int instantiated_something = 0;
int reconsider;
location_t saved_loc = input_location;
do
{
@ -11111,6 +11112,7 @@ instantiate_pending_templates (void)
}
while (reconsider);
input_location = saved_loc;
return instantiated_something;
}

View File

@ -1,3 +1,8 @@
2003-11-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11616
* g++.dg/template/instantiate5.C: New test.
2003-11-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/12726

View File

@ -0,0 +1,24 @@
// { dg-do compile }
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
// PR c++/11616: Incorrect line number in diagnostics
template <int> struct A
{
static const int i=0;
};
int baz() { return A<0>::i; }
struct B
{
static void foo (int); // { dg-error "candidates" }
};
template <typename T> struct C
{
virtual void bar() const { T::foo(); } // { dg-error "no matching function" }
};
C<B> c; // { dg-error "instantiated" }