OSDN Git Service

PR c++/11616
authorlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Nov 2003 14:37:57 +0000 (14:37 +0000)
committerlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Nov 2003 14:37:57 +0000 (14:37 +0000)
* pt.c (instantiate_pending_templates): Save and restore
input_location.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73269 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/instantiate5.C [new file with mode: 0644]

index c2eae49..a9656c1 100644 (file)
@@ -1,5 +1,11 @@
 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
        * friend.c (add_friend): Don't display previous declaration in
        case of duplicate friend warning.
index 600d240..e464af3 100644 (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;
 }
 
index 25f756a..bbff7c5 100644 (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
diff --git a/gcc/testsuite/g++.dg/template/instantiate5.C b/gcc/testsuite/g++.dg/template/instantiate5.C
new file mode 100644 (file)
index 0000000..8d07635
--- /dev/null
@@ -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" }