Translation unit #1:export module Q; export int sq(int i) { return i*i; }
Translation unit #2:export module R; export import Q;
Translation unit #3:import R; int main() { return sq(9); } // OK, sq from module Q — end example]
Translation unit #1:export module M; namespace R { export struct X {}; export void f(X); } namespace S { export void f(R::X, R::X); }
Translation unit #2:export module N; import M; export R::X make(); namespace R { static int g(X); } export template<typename T, typename U> void apply(T t, U u) { f(t, u); g(t); }
Translation unit #3:module Q; import N; namespace S { struct Z { template<typename T> operator T(); }; } void test() { auto x = make(); // OK, decltype(x) is R::X in module M R::f(x); // error: R and R::f are not visible here f(x); // OK, calls R::f from interface of M f(x, S::Z()); // error: S::f in module M not considered // even though S is an associated namespace apply(x, S::Z()); // error: S::f is visible in instantiation context, but // R::g has internal linkage and cannot be used outside TU #2 } — end example]
"decls.h":int f(); // #1, attached to the global module int g(); // #2, attached to the global module
Module interface of M:module; #include "decls.h" export module M; export using ::f; // OK, does not declare an entity, exports #1 int g(); // error: matches #2, but attached to M export int h(); // #3 export int k(); // #4
Other translation unit:import M; static int h(); // error: matches #3 int k(); // error: matches #4 — end example]
Translation unit #1:export module A; static void f() {} inline void it() { f(); } // error: is an exposure of f static inline void its() { f(); } // OK template<int> void g() { its(); } // OK template void g<0>(); decltype(f) *fp; // error: f (though not its type) is TU-local auto &fr = f; // OK constexpr auto &fr2 = fr; // error: is an exposure of f constexpr static auto fp2 = fr; // OK struct S { void (&ref)(); } s{f}; // OK, value is TU-local constexpr extern struct W { S &s; } wrap{s}; // OK, value is not TU-local static auto x = []{f();}; // OK auto x2 = x; // error: the closure type is TU-local int y = ([]{f();}(),0); // error: the closure type is not TU-local int y2 = (x,0); // OK namespace N { struct A {}; void adl(A); static void adl(int); } void adl(double); inline void h(auto x) { adl(x); } // OK, but certain specializations are exposures
Translation unit #2:module A; void other() { g<0>(); // OK, specialization is explicitly instantiated g<1>(); // error: instantiation uses TU-local its h(N::A{}); // error: overload set contains TU-local N::adl(int) h(0); // OK, calls adl(double) adl(N::A{}); // OK; N::adl(int) not found, calls N::adl(N::A) fr(); // OK, calls f constexpr auto ptr = fr; // error: fr is not usable in constant expressions here } — end example]
Parameter | float16_t | float32_t | float64_t | float128_t | bfloat16_t | |
ISO/IEC/IEEE 60559 name | binary16 | binary32 | binary64 | binary128 | ||
k, storage width in bits | 16 | 32 | 64 | 128 | 16 | |
p, precision in bits | 11 | 24 | 53 | 113 | 8 | |
emax, maximum exponent | 15 | 127 | 1023 | 16383 | 127 | |
w, exponent field width in bits | 5 | 8 | 11 | 15 | 8 |