Since r12-5426 apply_late_template_attributes suppresses various global
state to avoid applying active pragmas to earlier declarations; we also
need to override target_option_current_node.
PR c++/114772
PR c++/101180
gcc/cp/ChangeLog:
* pt.cc (apply_late_template_attributes): Also override
target_option_current_node.
gcc/testsuite/ChangeLog:
* g++.dg/ext/pragma-target2.C: New test.
(cherry picked from commit
5fdb0145fb9499f5db9e27f775895ce4a39215e4)
auto o3 = make_temp_override (current_target_pragma, NULL_TREE);
auto o4 = make_temp_override (scope_chain->omp_declare_target_attribute,
NULL);
+ auto o6 = make_temp_override (target_option_current_node,
+ target_option_default_node);
cplus_decl_attributes (decl_p, late_attrs, attr_flags);
--- /dev/null
+// PR c++/114772
+// { dg-do compile { target x86_64-*-* } }
+
+template<typename V, bool STREAMING>
+inline __attribute__((always_inline))
+__attribute__((warn_unused_result))
+int walk_document(V visitor) {return 0;}
+
+template<bool STREAMING>
+void parse_document() {
+ int r = walk_document<bool, STREAMING>(false);
+}
+
+void stage2_next() {
+ parse_document<true>();
+}
+
+#pragma GCC target("pclmul")