forked from gnustep/libobjc2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a4d095
commit c8cf72d
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <stdio.h> | ||
#import "objc/runtime.h" | ||
|
||
#if __has_attribute(objc_root_class) | ||
__attribute__((objc_root_class)) | ||
#endif | ||
@interface TestObj { id isa; } | ||
+ (Class)class; | ||
+ (id)testObj; | ||
+ (const char *)testStr; | ||
+ (int)testNum; | ||
@end | ||
|
||
@implementation TestObj | ||
+ (Class)class { | ||
return self; | ||
} | ||
+ (id)testObj { | ||
id testObj = @"Test"; | ||
printf("returning testObj: 0x%p\n", testObj); | ||
return testObj; | ||
} | ||
+ (const char *)testStr { | ||
return "forty two"; | ||
} | ||
+ (int)testNum { | ||
return 42; | ||
} | ||
@end | ||
|
||
int main() { | ||
id testClass = [TestObj class]; | ||
printf("testClass: %s (%p)\n", class_getName(testClass), testClass); | ||
TestObj *testObj = [TestObj testObj]; | ||
printf("testObj: 0x%p\n", testObj); | ||
const char *testStr = [TestObj testStr]; | ||
printf("testStr: %s\n", testStr); | ||
int testNum = [TestObj testNum]; | ||
printf("testNum: %d\n", testNum); | ||
|
||
if (testObj) { | ||
return 0; | ||
} else { | ||
return 1; | ||
} | ||
} |
c8cf72d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was supposed to reproduce llvm/llvm-project#56952 Building with Clang Release 14 on Windows 10, however, appears to work:
c8cf72d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to reproduce the issue, we have to build
libobjc
itself in release mode! Now both variants, with and without optimizations, fail in the same way: