summaryrefslogtreecommitdiffstats
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-11 22:27:32 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-11 22:27:32 +0000
commita5ed46c9e20352557a0fea7bf8fb9d8e04862566 (patch)
tree8082fe968555564efdd07e3add06e1110ab8b493 /gcc/doc/extend.texi
parent800dcaa0506115147f0bb93f0bc2200f6801469e (diff)
downloadppe42-gcc-a5ed46c9e20352557a0fea7bf8fb9d8e04862566.tar.gz
ppe42-gcc-a5ed46c9e20352557a0fea7bf8fb9d8e04862566.zip
* cp-tree.h (DECL_NAMESPACE_ASSOCIATIONS): New macro.
* name-lookup.c (parse_using_directive): New fn. (is_associated_namespace): New fn. (arg_assoc_namespace): Also check associated namespaces. * name-lookup.h: Declare new fns. * pt.c (maybe_process_partial_specialization): Allow specialization in associated namespace. * parser.c (cp_parser_using_directive): Accept attributes. Use parse_using_directive. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fdc1c7c6827..7825a12376d 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7649,6 +7649,7 @@ Predefined Macros,cpp,The GNU C Preprocessor}).
* Bound member functions:: You can extract a function pointer to the
method denoted by a @samp{->*} or @samp{.*} expression.
* C++ Attributes:: Variable, function, and type attributes for C++ only.
+* Strong Using:: Strong using-directives for namespace composition.
* Java Exceptions:: Tweaking exception handling to work with Java.
* Deprecated Features:: Things will disappear from g++.
* Backwards Compatibility:: Compatibilities with earlier definitions of C++.
@@ -8249,6 +8250,45 @@ interface table mechanism, instead of regular virtual table dispatch.
@end table
+See also @xref{Strong Using}.
+
+@node Strong Using
+@section Strong Using
+
+A using-directive with @code{__attribute ((strong))} is stronger
+than a normal using-directive in two ways:
+
+@itemize @bullet
+@item
+Templates from the used namespace can be specialized as though they were members of the using namespace.
+
+@item
+The using namespace is considered an associated namespace of all
+templates in the used namespace for purposes of argument-dependent
+name lookup.
+@end itemize
+
+This is useful for composing a namespace transparently from
+implementation namespaces. For example:
+
+@smallexample
+namespace std @{
+ namespace debug @{
+ template <class T> struct A @{ @};
+ @}
+ using namespace debug __attribute ((__strong__));
+ template <> struct A<int> @{ @}; // ok to specialize
+
+ template <class T> void f (A<T>);
+@}
+
+int main()
+@{
+ f (std::A<float>()); // lookup finds std::f
+ f (std::A<int>());
+@}
+@end smallexample
+
@node Java Exceptions
@section Java Exceptions
OpenPOWER on IntegriCloud