Commit 486c5299 by Nathan Sidwell Committed by Nathan Sidwell

[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.

From-SVN: r257665
parent 34c58a43
2018-02-14 Nathan Sidwell <nathan@acm.org>
* decl2.c (mark_vtable_entries): Set input_location to decl's.
(c_parse_final_cleanups): Restore input_location after emitting
vtables.
2018-02-14 Paolo Carlini <paolo.carlini@oracle.com> 2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove. * cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
......
...@@ -1825,6 +1825,11 @@ mark_vtable_entries (tree decl) ...@@ -1825,6 +1825,11 @@ mark_vtable_entries (tree decl)
function, so we emit the thunks there instead. */ function, so we emit the thunks there instead. */
if (DECL_THUNK_P (fn)) if (DECL_THUNK_P (fn))
use_thunk (fn, /*emit_p=*/0); 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); mark_used (fn);
} }
} }
...@@ -4727,6 +4732,9 @@ c_parse_final_cleanups (void) ...@@ -4727,6 +4732,9 @@ c_parse_final_cleanups (void)
reconsider = true; reconsider = true;
keyed_classes->unordered_remove (i); 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 /* Write out needed type info variables. We have to be careful
looping through unemitted decls, because emit_tinfo_decl may looping through unemitted decls, because emit_tinfo_decl may
......
2018-02-14 Nathan Sidwell <nathan@acm.org>
* g++.dg/template/instantiate5.C: Adjust required-from loc.
2018-02-14 Will Schmidt <will_schmidt@vnet.ibm.com> 2018-02-14 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/altivec-consts.c: Update compile stanzas. * gcc.target/powerpc/altivec-consts.c: Update compile stanzas.
......
...@@ -18,7 +18,12 @@ struct B ...@@ -18,7 +18,12 @@ struct B
template <typename T> struct C template <typename T> struct C
{ {
virtual void bar() const { T::foo(); } // { dg-error "no matching function" } virtual void bar() const // { dg-message "required" }
{
T::foo(); // { dg-error "no matching function" }
}
}; };
C<B> c; // { dg-message "required" } C<B> c;
int k;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment