void *),
void *);
extern tree match_mergeable_specialization (bool is_decl, spec_entry *);
-extern unsigned get_mergeable_specialization_flags (tree tmpl, tree spec);
+extern unsigned get_mergeable_specialization_flags (bool is_decl, tree tmpl,
+ tree spec);
extern void add_mergeable_specialization (bool is_decl, spec_entry *,
tree outer, unsigned);
extern tree add_to_template_args (tree, tree);
auto *entry = reinterpret_cast <spec_entry *> (dep->deps[0]);
if (streaming_p ())
- u (get_mergeable_specialization_flags (entry->tmpl, decl));
+ u (get_mergeable_specialization_flags (mk & MK_tmpl_decl_mask,
+ entry->tmpl, decl));
tree_node (entry->tmpl);
tree_node (entry->args);
}
specialization lists of TMPL. */
unsigned
-get_mergeable_specialization_flags (tree tmpl, tree decl)
+get_mergeable_specialization_flags (bool decl_p, tree tmpl, tree decl)
{
unsigned flags = 0;
+ tree spec = decl_p ? decl : TREE_TYPE (decl);
for (tree inst = DECL_TEMPLATE_INSTANTIATIONS (tmpl);
inst; inst = TREE_CHAIN (inst))
- if (TREE_VALUE (inst) == decl)
+ if (TREE_VALUE (inst) == spec)
{
flags |= 1;
break;
if (flags & 1)
DECL_TEMPLATE_INSTANTIATIONS (elt->tmpl)
- = tree_cons (elt->args, decl, DECL_TEMPLATE_INSTANTIATIONS (elt->tmpl));
+ = tree_cons (elt->args, elt->spec,
+ DECL_TEMPLATE_INSTANTIATIONS (elt->tmpl));
if (flags & 2)
{
--- /dev/null
+// PR c++/116364
+// { dg-additional-options "-fmodules-ts -Wno-global-module" }
+// { dg-module-cmi foo:part }
+
+module;
+template <typename> struct S {};
+template <> struct S<int>
+ { static constexpr bool value = true; };
+export module foo:part;
+
+export template <typename T>
+ constexpr bool result = S<T>::value;
--- /dev/null
+// PR c++/116364
+// { dg-additional-options "-fmodules-ts" }
+
+export module foo;
+export import :part;
--- /dev/null
+// PR c++/116364
+// { dg-additional-options "-fmodules-ts" }
+
+import foo;
+bool x = result<int>;