strong using directives

Nathan Sidwell nathan@acm.org
Thu Mar 9 19:15:00 GMT 2017


Jason,
looking at how we implement inline namespaces on the back of strong 
using directives, I notice that strong using is much more general.  One 
can name a target namespace from multple different strong using 
directives in different namespaces.  (The DECL_NAMESPACE_ASSOCIATIONS is 
a list of the namespaces that strongly use this one.) Abuse of that 
could lead to horrible performance of ADL searching and the like. And 
simply restricting to inline namespace semantics of being an immediate 
child namespace would permit some simplifications and presumably speed 
ups of name-lookup (even with transitivity).

The documentation though says that a strong using is equivalent to an 
inline namespace, and strong using will be removed in a future release:


> {Caution:} The semantics of this extension are equivalent
> to C++ 2011 inline namespaces.  Users should use inline namespaces
> instead as this extension will be removed in future versions of G++.
(added Jul 2012, which, in addition to noting inline namespace is now a 
thing, changed an existing 'may be removed' to 'will be removed')

1) the extra functionality of strong using seems pretty odd -- do you 
know of any uses of it?

2) what are your thoughts of actively deprecating strong using in gcc 7? 
I.e. emit a deprecation warning.

nathan
-- 
Nathan Sidwell



More information about the Gcc-patches mailing list