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:
parent
437a91e664
commit
aad626f71c
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
24
gcc/testsuite/g++.dg/template/instantiate5.C
Normal file
24
gcc/testsuite/g++.dg/template/instantiate5.C
Normal 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" }
|
Loading…
Reference in New Issue
Block a user