Is that code valid ?
Jason Merrill
jason@cygnus.com
Tue Nov 25 11:44:00 GMT 1997
>>>>> Pal Engstad <engstad@hunt.inmet.com> writes:
> Lassi Tuuren wrote:
>>
>> Olivier Galibert wrote:
>> > kftabdlg.cpp:549: parse error before `;'
>> > Line 549 is "return(QDate::QDate());"
>> >
>> > Changing that line to "return QDate();" works perfectly though.
>>
>> That is valid code, since the class name is found in its own scope.
>> Hence, one should be able to repeat `QDate::' arbitrary many times. > In
>> other words, assuming the proper declarations, the following is
>> perfectly valid, albeit weird code:
>>
>> return (QDate::QDate::QDate::QDate ());
> Please, do not write things out of thin air in this forum.
No, Lassi is correct. He was referring to
9 Classes [class]
2 A class-name is inserted into the scope in which it is declared imme-
diately after the class-name is seen. The class-name is also inserted
into the scope of the class itself.
Therefore, QDate::QDate refers to QDate.
Jason
More information about the Gcc
mailing list