Skip to content

Instantly share code, notes, and snippets.

@adaedra
Created October 8, 2012 09:11
Show Gist options
  • Save adaedra/3851553 to your computer and use it in GitHub Desktop.
Save adaedra/3851553 to your computer and use it in GitHub Desktop.
Objective-C Mangling FAIL !
#import <Edifice/EdObject.h>
#import <stdio.h>
@interface Test : EdObject
- (void) test: (int) i;
- (void) test_;
@end
@implementation Test
- (void) test: (int) i {
(void)i;
printf("-test:\n");
}
- (void) test_ {
printf("-test_\n");
}
@end
int main(void) {
Test * test = [[Test alloc] init];
[test test:42];
[test test_];
return 0;
}
@adaedra
Copy link
Author

adaedra commented Oct 8, 2012

This code compiles fine with Apple's GCC (Just use NSObject instead of EdObject)

But it fails with normal GCC (Tested here with MinGW) :
test.m:18:1: erreur: conflicting types for '-[Test test:]'
test.m:13:1: note: previous definition of '-[Test test:]' was here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment