This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16021] Tests for container swap specialisations FAIL in debug mode


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]