This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16021] Tests for container swap specialisations FAIL in debug mode
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jun 2004 17:49:06 -0000
- Subject: [Bug c++/16021] Tests for container swap specialisations FAIL in debug mode
- References: <20040616121506.16021.redi@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-06-30 17:49 -------
Hm, I _had_ to do it:
-----------------
namespace NS {}
namespace std {
using namespace NS __attribute__ ((strong));
class A{};
}
namespace NS {
template<typename _Tp, typename _A = std::A>
class X {
void swap (X&);
};
}
struct T {};
namespace std {
template<>
void X<T, A>::swap(X<T, A>&) {}
}
-------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc:19: error: `A' was not declared in this scope
x.cc:19: error: template argument 2 is invalid
x.cc:19: error: ISO C++ forbids declaration of `parameter' with no type
x.cc:19: error: no member function `swap' declared in `NS::X<T, std::A>'
x.cc:19: error: invalid function declaration
That's of course bogus: 'A' _is_ declared in this scope, since it's a class
inside namespace std, which we are presently in.
The code is extracted from debug mode libstdc++, in which NS is the namespace
in which the debug version of the containers are declared. If we want user
programs to be able to compile with both debug and non-debug mode, we need
to be able to allow specializations of NS::X members in namespace std, as
shown in the example. Thus, the code should really compile.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|libstdc++ |c++
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-06-30 17:49:04
date| |
Target Milestone|--- |3.4.2
Version|3.5.0 |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16021