Article View: gnu.g++.bug
Article #223"unexpected argument to constructor"
From: Thomas M. Breuel
Date: Sun, 09 Aug 1992 18:44
Date: Sun, 09 Aug 1992 18:44
36 lines
1725 bytes
1725 bytes
I believe in the following code, the GNU C++ compiler incorrectly
complains about "unexpected argument to constructor `Match'"; the
default copy constructor should get generated and used by the compiler
(if "vec2" is replaced with "float", there is no complaint).
================================================================
struct vec2 {
float x,y;
vec2() {}
vec2(float x,float y):x(x),y(y) {}
};
struct Match {
vec2 t;
vec2 r;
float quality;
float maxerr;
};
Match f() {
Match x;
return x;
}
================================================================
cd /fs/vision01/tmb/src/char/
gcc -c -g -v test.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc/2.2.2/specs
gcc version 2.2.2
/sym/gnu/lib/gcc-lib/sparc/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g test.cc /local/tmp/cca11642.i
GNU CPP version 2.2.2 (sparc)
/sym/gnu/lib/gcc-lib/sparc/2.2.2/cc1plus /local/tmp/cca11642.i -quiet -dumpbase test.cc -g -version -o /local/tmp/cca11642.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
test.cc: In function `struct Match f ()':
test.cc:16: unexpected argument to constructor `Match'
Compilation exited abnormally with code 1 at Sun Aug 9 16:42:03
Technical Details
Message-ID:
<9208091444.AA02628@idiap.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmbShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmb From: tmb@idiap.CH (Thomas M. Breuel) Subject: "unexpected argument to constructor" Message-ID: <9208091444.AA02628@idiap.ch> Sender: gnulists@ai.mit.edu Reply-To: tmb@idiap.ch Organization: GNUs Not Usenet Distribution: gnu Date: Sun, 9 Aug 1992 18:44:38 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 37