This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/5023: Error declaring constructor of template class specialization as friend
- From: jsberg at bnl dot gov
- To: gcc-gnats at gcc dot gnu dot org
- Date: Wed, 5 Dec 2001 17:36:58 -0500
- Subject: c++/5023: Error declaring constructor of template class specialization as friend
>Number: 5023
>Category: c++
>Synopsis: Error declaring constructor of template class specialization as friend
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Dec 05 14:46:08 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.0.2
>Organization:
>Environment:
System: Linux jsberg1 2.4.9 #2 SMP Tue Aug 21 17:36:52 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.2/configure --prefix=/opt/gcc-3.0.2
>Description:
This code:
template<class C> class S {
public:
S();
private:
};
class T {
friend S<int>::S<int>();
public:
T();
private:
void f() const;
};
template<class C> S<C>::S() {
// T t; t.f();
}
S<int> s;
Compiled with this command line:
c++ -c test02.cxx
Gives this error
test02.cxx:8: no `void S<int>::S()' member function declared in class `S<int>'
>How-To-Repeat:
>Fix:
Plenty of workarounds:
friend class S<int>;
or
template<class C> friend S<C>::S();
>Release-Note:
>Audit-Trail:
>Unformatted: