Article View: comp.unix.programmer
Article #3380Re: return type specification for constructor invalid
From: Greg Comeau
Date: Fri, 24 Jan 1997 00:00
Date: Fri, 24 Jan 1997 00:00
39 lines
2141 bytes
2141 bytes
In article <m820bbi5yc.fsf@slbh08.bln.sel.alcatel.de> prange@bln.sel.alcatel.de writes:
>
>I issued the command "g++ -Wall -ansi -c HTMLAppearance.cc" on the command
>>line and received the following error from the compiler:
>>
>> return type specification for constructor invalid
>>
>>for the line
>>
>> HTMLAppearance:: HTMLAppearance( const String filename ) {
>>
>
>This is actually fun to see _three_ people responding and not
>seeing that the problem is on the follwing line ( which has been
>quoted also several times )
>
>HTMLAppearance:: HTMLAppearance( const String filename ) {
>
>which should read:
>
>HTMLAppearance::HTMLAppearance( const String filename ) {
From what I can see, you have only removed a space.
Indeed, that makes no difference, or shouldn't, unless you
have a broken C++ compiler. Something else _is_ wrong.
Since he defined his constructor outside the class,
more than likely he left off the semicolon after the closing
} of the class and hence it got taken as the return type of the ctor,
which is not allowed. There are actually 2 errors then:
(1) A ctor cannot return a value
(2) A type cannot be defined when specifying a return type
- Greg
--
Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
Producers of Comeau C++ 4.0 front-end pre-release
****WEB: http://www.comeaucomputing.com / Voice:718-945-0009 / Fax:718-441-2310
Here:comeau@comeaucomputing.com / BIX:comeau or comeau@bix.com / CIS:72331,3421
Technical Details
Message-ID:
<5cajrq$pfd@panix.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<5bnn6t$m9l@scapa.cs.ualberta.ca> <5bontn$nsh@panix.com> <m820bbi5yc.fsf@slbh08.bln.sel.alcatel.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,d1c878ee12dbf96a X-Google-Attributes: gidfc89c,public X-Google-Thread: f97d0,d1c878ee12dbf96a X-Google-Attributes: gidf97d0,public From: comeau@panix.com (Greg Comeau) Subject: Re: return type specification for constructor invalid Date: 1997/01/24 Message-ID: <5cajrq$pfd@panix.com> X-Deja-AN: 211911242 references: <5bnn6t$m9l@scapa.cs.ualberta.ca> <5bontn$nsh@panix.com> <m820bbi5yc.fsf@slbh08.bln.sel.alcatel.de> organization: Comeau Computing reply-to: comeau@comeaucomputing.com newsgroups: comp.unix.programmer,gnu.g++