From e2f46fbf9005861b21c93f6d48cf7713f7f3c0c8 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 14 Feb 2018 16:31:26 +0000 Subject: [C++ PATCH]: instantiation via vtable marking https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00850.html gcc/cp/ * decl2.c (mark_vtable_entries): Set input_location to decl's. (c_parse_final_cleanups): Restore input_location after emitting vtables. gcc/testsuite/ * g++.dg/template/instantiate5.C: Adjust required-from loc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257665 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/decl2.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 2da6f9023c5..d2693ce458b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1825,6 +1825,11 @@ mark_vtable_entries (tree decl) function, so we emit the thunks there instead. */ if (DECL_THUNK_P (fn)) use_thunk (fn, /*emit_p=*/0); + /* Set the location, as marking the function could cause + instantiation. We do not need to preserve the incoming + location, as we're called from c_parse_final_cleanups, which + takes care of that. */ + input_location = DECL_SOURCE_LOCATION (fn); mark_used (fn); } } @@ -4727,6 +4732,9 @@ c_parse_final_cleanups (void) reconsider = true; keyed_classes->unordered_remove (i); } + /* The input_location may have been changed during marking of + vtable entries. */ + input_location = locus_at_end_of_parsing; /* Write out needed type info variables. We have to be careful looping through unemitted decls, because emit_tinfo_decl may -- cgit v1.2.1