[temp.dep.res] (original) (raw)
[Example 4:
Module interface unit of A:export module A;export template<typename T> void f(T t) { cat(t, t); dog(t, t); }
Module interface unit of B:export module B;import A;export template<typename T, typename U> void g(T t, U u) { f(t);}
Source file "foo.h", not an importable header:struct foo { friend int cat(foo, foo);};int dog(foo, foo);
Module interface unit of C1:module;#include "foo.h" export module C1;import B;export template<typename T> void h(T t) { g(foo{ }, t);}
Translation unit:import C1;void i() { h(0); }
Importable header "bar.h":struct bar { friend int cat(bar, bar);};int dog(bar, bar);
Module interface unit of C2:module;#include "bar.h" export module C2;import B;export template<typename T> void j(T t) { g(bar{ }, t);}
Translation unit:import C2;void k() { j(0); } — _end example_]