This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: Problem about initialize a mutex object in a class


Thank you for your reply.
In fact, I do have the semicolone in my code.:(

2007/5/7, jlh <jlh@gmx.ch>:
Hello!

Your class definition is missing the semicolon after the closing
brace.  My g++-4.1.1 even warns about it:

a.c:11: error: new types may not be defined in a return type
a.c:11: note: (perhaps a semicolon is missing after the definition of 'Thread')
a.c:11: error: return type specification for constructor invalid

Because of the missing semicolon, the class is parsed as the
return type of the following constructor, i.e., as in "int func()"
it parses "class { } func()", and only later notices that
constructors shouldn't have a return type.

jlh



--
åä
        çå
MSN:haoniukun@hotmail.com

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