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]
Other format: [Raw text]

[Bug objc/49301] New: Forward declaration of classes broken


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49301

           Summary: Forward declaration of classes broken
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: objc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jos@kuijpersvof.nl


In the current gcc from SVN is the meaning of @class broken.

@class is used to tell the compiler the class exists, but that its not (yet)
available. Eg: class B uses class A, but class A uses class B too, creating a
recursive import, and thus goes wrong.

Using @class now broke. This is the warning the compiler gives, for example:


OFConnectionFailedException.m: In function Ã-[OFConnectionFailedException
dealloc]Ã:
OFConnectionFailedException.m:68:2: warning: @interface of class ÃOFTCPSocketÃ
not found [enabled by default]

It seems like @class is expecting the @interface to follow in the same file...

Please recover the function of @class as it is an important functionality.


Example.m:
[code]
#import <objc/objc.h>
#import <objc/Object.h>

@class myClass;

int main()
{
    myClass *obj = [myClass new];
}

@interface myClass : Object
@end

@implementation myClass
@end
[/code]


$ gcc -lobjc Example.m
Example.m: In function ÃmainÃ:
Example.m:8:2: warning: @interface of class ÃmyClassà not found [enabled by
default]


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