https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109753
--- Comment #22 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:e397f8524a7982004eb616217477434ce350e80f commit r15-2332-ge397f8524a7982004eb616217477434ce350e80f Author: Jason Merrill <ja...@redhat.com> Date: Thu Jul 25 17:36:09 2024 -0400 c++: #pragma target and deferred instantiation [PR115403] My patch for 109753 applies the current #pragma target/optimize to a function when we compile it, which was a problem for a template instantiation deferred until EOF, where different #pragmas are active. So let's only do this for artificial functions. PR c++/115403 PR c++/109753 gcc/cp/ChangeLog: * decl.cc (start_preparsed_function): Only call decl_attributes for artificial functions. gcc/testsuite/ChangeLog: * g++.dg/ext/pragma-target1.C: New test.