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]

a step backward from egcs-902021 to egcs-980302 ?



Hello there,

Using g++ 2.7.2.1 or egcs-980221 on the following code

int
main(int argc, char *argv[])
{
	return 1;
};

int
main()
{
	return 2;
};

on machine i486-pc-linux-gnulibc1 then I get

/tmp/cca29102.s: Assembler messages:
/tmp/cca29102.s:26: Fatal error: Symbol main already defined.

which is ok, but not brilliant, as an error message.  But when I use
egcs-980302 on the same machine I get

mar3.cc: In function `int main()':
mar3.cc:10: Error: Internal compiler error 378.
mar3.cc:10: Error: Please submit a full bug report to `egcs-bugs@cygnus.com'.

It seems that having two versions of main in the same file is not a
likely error, but my understanding of C++ is that it is an error which
should be diagnosed.

There is the related issue of what happens when the two definitions
are in two different files.

Regards

David Binderman MSc BSc    +44 1293 534 847       dcb_AVOID_JUNK_MAIL@pncl.co.uk
There is no substitute for skill, taste and experience when programming
 - Dr Stroustrup, inventor of C++



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