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]

Re: Internal error, RHv6.0 i386 gcc v2.95.2


"Martin v. Loewis" wrote:
> 
> > Having troubles compiling the smart ptr library from KSVH software
> > (Kevin S. Van Horn).  See attached preprocessor output.
> 
> Thanks for your bug report. The mainline compiler (2.96 20000302
> (experimental)) says
> 
> smart_ptr.hxx:386: specializing `class
> smart_ptr.hxx:386: ksvh::smart_ptr_aux::inv_rcnt_ptr<cow, const_prop,
> smart_ptr.hxx:386: nullok, T>' in different namespace
> smart_ptr.hxx:187:   from definition of `template <bool cow, bool
> smart_ptr.hxx:187: const_prop, bool nullok, class T> class
> smart_ptr.hxx:187: ksvh::smart_ptr_aux::inv_rcnt_ptr'
> smart_ptr.hxx:386: partial specialization
> smart_ptr.hxx:386: `ksvh::smart_ptr_aux::inv_rcnt_ptr<cow, const_prop,
> smart_ptr.hxx:386: nullok, T>' does not specialize any template
> smart_ptr.hxx:386: arguments
> smart_ptr.hxx:386: partial specialization
> smart_ptr.hxx:386: `ksvh::smart_ptr_aux::inv_rcnt_ptr<cow, const_prop,
> smart_ptr.hxx:386: nullok, T>' declared `friend'
> 
> so it appears that the bug has been fixed.

Are you sure it's fixed?  Unless I'm mistaken, line 386 is merely
declaring a friend template class, not specializing the class.  Here
is an excerpt around where the error is being reported:

class refcnt_base {
protected:
  refcnt_base() : refcnt(0) { }
  refcnt_base(refcnt_base const &) : refcnt(0) { }
  void operator=(refcnt_base const &) { }
  ~refcnt_base()
    { assert(refcnt == 0); }

private:
  mutable size_t refcnt;
  template <bool cow, bool const_prop, bool nullok, class T>       //
line 385
  friend class smart_ptr_aux::inv_rcnt_ptr<cow, const_prop, nullok,
T>; // 386
};


I don't think this should result in a compiler error.  Here is a much
simpler case that exhibits the same error.  This compiles fine on
HP-UX aCC v1.21 (which means nothing other than it compiles somewhere
;)


namespace one {
    template <class T>
    class A {};
};

namespace two {
    class B {
        template <class T>
        friend class one::A<T>;
    };
};

int main(int argc, char** argv)
{
    two::B b;
}


This yields the following compiler message...

[carl@czech services]$ g++ -o simple simple.cxx
simple.cxx:9: specializing `class one::A<T>' in different namespace
simple.cxx:3:   from definition of `template <class T> class one::A'
simple.cxx:9: partial specialization `one::A<T>' does not specialize
simple.cxx:9: any template arguments
simple.cxx:9: partial specialization `one::A<T>' declared `friend'
[carl@czech services]$ g++ -v
Reading specs from /opt/local/lib/gcc-lib/i686-pc-linux-gnu/2.96/specs
gcc version 2.96 20000306 (experimental)
[carl@czech services]$

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