c++: local-decls are never member fns [PR97186]
authorNathan Sidwell <nathan@acm.org>
Thu, 24 Sep 2020 13:17:00 +0000 (06:17 -0700)
committerNathan Sidwell <nathan@acm.org>
Thu, 24 Sep 2020 13:21:54 +0000 (06:21 -0700)
commit2e66e53b1efb98f5cf6b0a123990c1ca999affd7
tree66754b09c5129df8e0f1e119c65e7640a0885c58
parent9de8fa8052154a83b82f8b3785ec100d8cb24261
c++: local-decls are never member fns [PR97186]

This fixes an ICE in noexcept instantiation.  It was presuming
functions always have template_info, but that changed with my
DECL_LOCAL_DECL_P changes.  Fortunately DECL_LOCAL_DECL_P fns are
never member fns, so we don't need to go fishing out a this pointer.

Also I realized I'd misnamed local10.C, so renaming it local-fn3.C,
and while there adding the effective-target lto that David E pointed
out was missing.

PR c++/97186
gcc/cp/
* pt.c (maybe_instantiate_noexcept): Local externs are never
member fns.
gcc/testsuite/
* g++.dg/template/local10.C: Rename ...
* g++.dg/template/local-fn3.C: .. here.  Require lto.
* g++.dg/template/local-fn4.C: New.
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/local-fn3.C [moved from gcc/testsuite/g++.dg/template/local10.C with 87% similarity]
gcc/testsuite/g++.dg/template/local-fn4.C [new file with mode: 0644]