OSDN Git Service

Backport r176845.
authorjyasskin <jyasskin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Jul 2011 22:13:18 +0000 (22:13 +0000)
committerjyasskin <jyasskin@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Jul 2011 22:13:18 +0000 (22:13 +0000)
Propagate the source location of a template's function_decl to the
template_decl built out of it.  Without this, specializations
generated before the template was defined get the location of the
closing ')' instead of the location of the template's name, which can
produce inconsistent locations between translation units, which makes
gold's ODR checker unhappy.

* gcc/cp/pt.c (build_template_decl): Copy the function_decl's source
location to the new template_decl.
* gcc/testsuite/g++.old-deja/g++.pt/crash60.C: Updated.
* libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Updated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@176851 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/crash60.C
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc

index c015898..77b3148 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-27  Jeffrey Yasskin  <jyasskin@google.com>
+
+       * pt.c (build_template_decl): Copy the function_decl's
+       source location to the new template_decl.
+
 2011-07-19  Jason Merrill  <jason@redhat.com>
 
        PR c++/49785
index 671fdc2..d6a953d 100644 (file)
@@ -4109,6 +4109,7 @@ build_template_decl (tree decl, tree parms, bool member_template_p)
   tree tmpl = build_lang_decl (TEMPLATE_DECL, DECL_NAME (decl), NULL_TREE);
   DECL_TEMPLATE_PARMS (tmpl) = parms;
   DECL_CONTEXT (tmpl) = DECL_CONTEXT (decl);
+  DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
   DECL_MEMBER_TEMPLATE_P (tmpl) = member_template_p;
 
   return tmpl;
index 79f931c..21e73e6 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-27  Jeffrey Yasskin  <jyasskin@google.com>
+
+       * g++.old-deja/g++.pt/crash60.C: Updated.
+
 2011-07-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/49866
index 1aad621..893ac31 100644 (file)
@@ -5,9 +5,9 @@
 // We ICE'd rather than fail to instantiate.
 
 template< typename SID, class SDR >
-void k( SID sid, SDR* p,
+void k( SID sid, SDR* p,       // { dg-message "note" }
  void (SDR::*)
- ( typename SID::T ) );                // { dg-message "note" }
+ ( typename SID::T ) );
 
 struct E { };
 struct S { void f( int ); };
index ded2d6c..a5a40f1 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-27  Jeffrey Yasskin  <jyasskin@google.com>
+
+       * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Updated.
+
 2011-07-22  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline
index 63f44d1..a210d04 100644 (file)
@@ -43,11 +43,11 @@ main()
 }
 
 // { dg-warning "note" "" { target *-*-* } 354 }
-// { dg-warning "note" "" { target *-*-* } 1086 }
-// { dg-warning "note" "" { target *-*-* } 469 }
-// { dg-warning "note" "" { target *-*-* } 587 }
-// { dg-warning "note" "" { target *-*-* } 1050 }
-// { dg-warning "note" "" { target *-*-* } 1056 }
-// { dg-warning "note" "" { target *-*-* } 342 }
-// { dg-warning "note" "" { target *-*-* } 292 }
+// { dg-warning "note" "" { target *-*-* } 1085 }
+// { dg-warning "note" "" { target *-*-* } 468 }
+// { dg-warning "note" "" { target *-*-* } 586 }
+// { dg-warning "note" "" { target *-*-* } 1049 }
+// { dg-warning "note" "" { target *-*-* } 1055 }
+// { dg-warning "note" "" { target *-*-* } 341 }
+// { dg-warning "note" "" { target *-*-* } 291 }
 // { dg-warning "note" "" { target *-*-* } 207 }