2017-01-26 Jason Merrill <jason@redhat.com>
+ * name-lookup.c (parse_using_directive): Deprecate strong using.
+
PR c++/79176 - lambda ICE with -flto -Os
* decl2.c (vague_linkage_p): Handle decloned 'tors.
* tree.c (decl_linkage): Likewise.
tree name = get_attribute_name (a);
if (is_attribute_p ("strong", name))
{
+ warning (OPT_Wdeprecated, "strong using is deprecated; use inline "
+ "namespaces instead");
if (!toplevel_bindings_p ())
error ("strong using only meaningful at namespace scope");
else if (name_space != error_mark_node)
method denoted by a @samp{->*} or @samp{.*} expression.
* C++ Attributes:: Variable, function, and type attributes for C++ only.
* Function Multiversioning:: Declaring multiple function versions.
-* Namespace Association:: Strong using-directives for namespace association.
* Type Traits:: Compiler support for type traits.
* C++ Concepts:: Improved support for generic programming.
* Deprecated Features:: Things will disappear from G++.
@end table
-See also @ref{Namespace Association}.
-
@node Function Multiversioning
@section Function Multiversioning
@cindex function versions
@uref{http://gcc.gnu.org/wiki/FunctionMultiVersioning, GCC wiki on
Function Multiversioning} for more details.
-@node Namespace Association
-@section Namespace Association
-
-@strong{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++.
-
-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 and explicitly
-instantiated 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
-
-The used namespace must be nested within the using namespace so that
-normal unqualified lookup works properly.
-
-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> @{ @}; // @r{OK to specialize}
-
- template <class T> void f (A<T>);
-@}
-
-int main()
-@{
- f (std::A<float>()); // @r{lookup finds} std::f
- f (std::A<int>());
-@}
-@end smallexample
-
@node Type Traits
@section Type Traits
--- /dev/null
+// PR c++/13594 (secondary)
+
+// { dg-options "" }
+// { dg-do compile }
+
+namespace fool {
+ inline namespace foo {
+ template <class T> void swap(T, T);
+ }
+ template <class T> void swap(T);
+}
+
+int main() {
+ // we used to fail to look up the associated namespace here
+ fool::swap(1, 1);
+}
--- /dev/null
+// PR c++/13594
+
+// { dg-options "" }
+// { dg-do compile }
+
+namespace foo {
+ inline namespace foo_impl {
+ class T; // { dg-message "T" "" }
+ }
+}
+namespace bar {
+ inline namespace bar_impl {
+ class T; // { dg-message "T" "" }
+ }
+ using namespace foo;
+}
+namespace baz {
+ using namespace foo;
+ using namespace bar;
+}
+
+foo::T *t1;
+bar::T *t2;
+baz::T *t3; // { dg-error "(ambiguous|does not name a type)" "" }
--- /dev/null
+// PR c++/13659
+
+// { dg-options "" }
+// { dg-do compile }
+
+namespace bar {
+ inline namespace foo {
+ template <class T> void f(T, T);
+ }
+ template <class T> void f(T);
+}
+
+int main() {
+ // Make sure both declarations are brought in.
+ using bar::f;
+ f(1);
+ f(1, 1);
+}
--- /dev/null
+// PR c++/33486
+
+// { dg-options "" }
+
+namespace A
+{
+ inline namespace B
+ {
+ struct T
+ {
+ struct U { };
+ U f();
+ };
+ }
+
+ inline namespace C
+ {
+ void g (T::U);
+ }
+}
+
+int main()
+{
+ A::T t;
+ g(t.f());
+}
+++ /dev/null
-// PR c++/13594 (secondary)
-
-// { dg-options "" }
-// { dg-do compile }
-
-namespace fool {
- inline namespace foo {
- template <class T> void swap(T, T);
- }
- template <class T> void swap(T);
-}
-
-int main() {
- // we used to fail to look up the associated namespace here
- fool::swap(1, 1);
-}
+++ /dev/null
-// PR c++/13594
-
-// { dg-options "" }
-// { dg-do compile }
-
-namespace foo {
- inline namespace foo_impl {
- class T; // { dg-message "T" "" }
- }
-}
-namespace bar {
- inline namespace bar_impl {
- class T; // { dg-message "T" "" }
- }
- using namespace foo;
-}
-namespace baz {
- using namespace foo;
- using namespace bar;
-}
-
-foo::T *t1;
-bar::T *t2;
-baz::T *t3; // { dg-error "(ambiguous|does not name a type)" "" }
+++ /dev/null
-// PR c++/13659
-
-// { dg-options "" }
-// { dg-do compile }
-
-namespace bar {
- inline namespace foo {
- template <class T> void f(T, T);
- }
- template <class T> void f(T);
-}
-
-int main() {
- // Make sure both declarations are brought in.
- using bar::f;
- f(1);
- f(1, 1);
-}
+++ /dev/null
-// PR c++/16301
-
-// { dg-do compile }
-
-namespace NS2
-{
- using namespace NS1 __attribute__ ((strong)); // { dg-error "" }
-}
+++ /dev/null
-// PR c++/33486
-
-// { dg-options "" }
-
-namespace A
-{
- inline namespace B
- {
- struct T
- {
- struct U { };
- U f();
- };
- }
-
- inline namespace C
- {
- void g (T::U);
- }
-}
-
-int main()
-{
- A::T t;
- g(t.f());
-}
};
} // namespace __cxx1998
- // namespace __debug __attribute__ ((strong));
inline namespace __debug { }
}
</pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="methods.coexistence.link"></a>Link- and run-time coexistence of release- and
};
} // namespace __cxx1998
- // namespace __debug __attribute__ ((strong));
inline namespace __debug { }
}
</programlisting>