Article View: gnu.g++.bug
Article #790gcc (g++) 2.2.2 constructing nested class from external scope
From: bilmes
Date: Wed, 26 Aug 1992 10:51
Date: Wed, 26 Aug 1992 10:51
39 lines
2383 bytes
2383 bytes
I believe the following is a bug. It seems to works fine with Cfront 2.1.
The problem is that g++ doesn't think it is valid to construct an instance
of a nested class in an argument taking an instance of a nested class, and where
the nested class may be constructed from another type, in this case int.
Here's the info.
-------- bla.cc -------------------------------------------------------------
class foo {
class bar {
int i;
public:
bar(int j) { i = j; }
};
bar b;
public:
foo() : b(3) {}
void test(bar lb) { b = lb; }
};
main() {
foo f;
f.test(34); // line 18
}
-----------------------------------------------------------------------------
Reading specs from /usr/local/lib/gcc-lib/mips-dec-ultrix4.2/2.2.2/specs
gcc version 2.2.2
/usr/local/lib/gcc-lib/mips-dec-ultrix4.2/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -Dbsd4_2 -Dhost_mips -Dmips -Dultrix -Dunix -D__ANSI_COMPAT -D__MIPSEL__ -D__R3000__ -D__SYSTYPE_BSD__ -D___SYSTYPE_BSD__ -D__bsd4_2__ -D__host_mips__ -D__mips__ -D__ultrix__ -D__unix__ -D__ANSI_COMPAT -D__MIPSEL -D__R3000 -D__SYSTYPE_BSD -D___SYSTYPE_BSD -D__bsd4_2 -D__host_mips -D__mips -D__ultrix -D__unix -I/usr/local/lib/gcc-lib/m
ips-dec-ultrix4.2/2.2.2/lib/g++-include -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C bla.cc /usr/tmp/cca16989.i
GNU CPP version 2.2.2 [AL 1.1, MM 19] DECstation running ultrix
/usr/local/lib/gcc-lib/mips-dec-ultrix4.2/2.2.2/cc1plus /usr/tmp/cca16989.i -quiet -dumpbase bla.cc -version -o /usr/tmp/cca16989.s
GNU C++ version 2.2.2 [AL 1.1, MM 19] DECstation running ultrix compiled by GNU C version 2.2.2.
bla.cc: In function `int main ()':
bla.cc:18: no constructor named `bar' in visible scope
bla.cc:18: in conversion to type `bar'
Technical Details
Message-ID:
<9208261851.AA16997@josquin.media.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!media.mit.edu!bilmesShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!media.mit.edu!bilmes From: bilmes@media.mit.edu Subject: gcc (g++) 2.2.2 constructing nested class from external scope Message-ID: <9208261851.AA16997@josquin.media.mit.edu> Sender: gnulists@ai.mit.edu Reply-To: Jeff Bilmes <bilmes@media-lab.media.mit.edu> (617/253-8163) Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 26 Aug 1992 10:51:17 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 39