This is the mail archive of the gcc@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]

Re: Is that code valid ?


>>>>> 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


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