We weren't streaming a C++20 dependent explicit-specifier.
PR c++/103752
gcc/cp/ChangeLog:
* module.cc (trees_out::core_vals): Stream explicit specifier.
(trees_in::core_vals): Likewise.
* pt.cc (store_explicit_specifier): No longer static.
(tsubst_function_decl): Clear DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
* cp-tree.h (lookup_explicit_specifier): Declare.
gcc/testsuite/ChangeLog:
* g++.dg/modules/explicit-bool-1_b.C: New test.
* g++.dg/modules/explicit-bool-1_a.H: New test.
extern bool template_guide_p (const_tree);
extern bool builtin_guide_p (const_tree);
extern void store_explicit_specifier (tree, tree);
+extern tree lookup_explicit_specifier (tree);
extern void walk_specializations (bool,
void (*)(bool, spec_entry *,
void *),
WT (t->function_decl.function_specific_target);
WT (t->function_decl.function_specific_optimization);
WT (t->function_decl.vindex);
+
+ if (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P (t))
+ WT (lookup_explicit_specifier (t));
break;
case USING_DECL:
RT (t->function_decl.function_specific_target);
RT (t->function_decl.function_specific_optimization);
RT (t->function_decl.vindex);
+
+ if (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P (t))
+ {
+ tree spec;
+ RT (spec);
+ store_explicit_specifier (t, spec);
+ }
}
break;
/* Lookup an element in EXPLICIT_SPECIFIER_MAP. */
-static tree
+tree
lookup_explicit_specifier (tree v)
{
return *explicit_specifier_map->get (v);
/*function_p=*/false,
/*i_c_e_p=*/true);
spec = build_explicit_specifier (spec, complain);
- DECL_NONCONVERTING_P (r) = (spec == boolean_true_node);
+ if (instantiation_dependent_expression_p (spec))
+ store_explicit_specifier (r, spec);
+ else
+ {
+ DECL_NONCONVERTING_P (r) = (spec == boolean_true_node);
+ DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P (r) = false;
+ }
}
/* OpenMP UDRs have the only argument a reference to the declared
--- /dev/null
+// PR c++/103752
+// { dg-additional-options -fmodule-header }
+// { dg-require-effective-target c++20 }
+
+template<typename _T1, typename _T2>
+struct pair
+{
+ constexpr
+ explicit(__is_same(_T1, _T2))
+ pair()
+ { }
+
+ _T1 first;
+ _T2 second;
+};
+
+struct string
+{
+ string() { }
+ string(const char* s) : s(s) { }
+
+ const char* s = "";
+};
--- /dev/null
+// { dg-additional-options -fmodules-ts }
+// { dg-require-effective-target c++20 }
+
+export module x;
+import "explicit-bool-1_a.H";
+pair<string, string> environment;