From ce77c22f1bf5674d60710fba3cf8c43d502db01b Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Wed, 27 Jul 2011 18:38:48 +0000 Subject: [PATCH] Propagate the source location of a template's function_decl to the template_decl built out of it. 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. From-SVN: r176845 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 1 + gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.old-deja/g++.pt/crash60.C | 4 ++-- libstdc++-v3/ChangeLog | 4 ++++ .../20_util/weak_ptr/comparison/cmp_neg.cc | 16 ++++++++-------- 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d169ed14a33..653a0ab4d49 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-07-27 Jeffrey Yasskin + + * pt.c (build_template_decl): Copy the function_decl's + source location to the new template_decl. + 2011-07-26 Paolo Carlini PR c++/49776 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 178685c40d4..b9e09af7e26 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4121,6 +4121,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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a5fd846f32e..952c3ca1136 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-07-27 Jeffrey Yasskin + + * g++.old-deja/g++.pt/crash60.C: Updated. + 2011-07-27 Jakub Jelinek PR target/49866 diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash60.C b/gcc/testsuite/g++.old-deja/g++.pt/crash60.C index 747af9b4090..1be4678e1f4 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash60.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash60.C @@ -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-error "no type named 'T'" } void (SDR::*) - ( typename SID::T ) ); // { dg-error "no type named 'T'" } + ( typename SID::T ) ); struct E { }; struct S { void f( int ); }; diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 38833b71e76..dd6723fb3f8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2011-07-27 Jeffrey Yasskin + + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Updated. + 2011-07-25 Benjamin Kosnik * include/std/array (at): Remove constexpr when -fno-exceptions. diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc index df18712f73b..6eecc2d2aeb 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc @@ -44,16 +44,16 @@ main() // { dg-warning "note" "" { target *-*-* } 370 } // { dg-warning "note" "" { target *-*-* } 365 } -// { dg-warning "note" "" { target *-*-* } 357 } +// { dg-warning "note" "" { target *-*-* } 356 } // { dg-warning "note" "" { target *-*-* } 1103 } // { dg-warning "note" "" { target *-*-* } 1098 } -// { dg-warning "note" "" { target *-*-* } 1090 } +// { dg-warning "note" "" { target *-*-* } 1089 } // { dg-warning "note" "" { target *-*-* } 485 } // { dg-warning "note" "" { target *-*-* } 479 } -// { dg-warning "note" "" { target *-*-* } 469 } -// { dg-warning "note" "" { target *-*-* } 814 } -// { dg-warning "note" "" { target *-*-* } 1056 } -// { dg-warning "note" "" { target *-*-* } 1050 } -// { dg-warning "note" "" { target *-*-* } 342 } -// { dg-warning "note" "" { target *-*-* } 292 } +// { dg-warning "note" "" { target *-*-* } 468 } +// { dg-warning "note" "" { target *-*-* } 813 } +// { dg-warning "note" "" { target *-*-* } 1055 } +// { dg-warning "note" "" { target *-*-* } 1049 } +// { dg-warning "note" "" { target *-*-* } 341 } +// { dg-warning "note" "" { target *-*-* } 291 } // { dg-warning "note" "" { target *-*-* } 224 } -- 2.30.2