diff options
author | Jason Merrill <jason@redhat.com> | 2003-11-11 17:27:32 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-11-11 17:27:32 -0500 |
commit | 86098eb892eb05e5da0c9eba207a75024c0fb91b (patch) | |
tree | 8082fe968555564efdd07e3add06e1110ab8b493 /gcc/doc | |
parent | 292d9f2bcd1b1f21ae717064c7c9823b3a9c83cc (diff) | |
download | gcc-86098eb892eb05e5da0c9eba207a75024c0fb91b.zip gcc-86098eb892eb05e5da0c9eba207a75024c0fb91b.tar.gz gcc-86098eb892eb05e5da0c9eba207a75024c0fb91b.tar.bz2 |
cp-tree.h (DECL_NAMESPACE_ASSOCIATIONS): New macro.
* 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.
From-SVN: r73468
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index fdc1c7c..7825a12 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 |