mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
35 lines
688 B
Plaintext
35 lines
688 B
Plaintext
// #target: macos-x64
|
|
module foo;
|
|
struct Data{
|
|
inline char[32] data;
|
|
}
|
|
fn void Data.not_working(self) {
|
|
self[:self.data.len];
|
|
}
|
|
|
|
fn void Data.working(self) {
|
|
self.data[:self.data.len];
|
|
}
|
|
fn void main(String[] args) {
|
|
Data d;
|
|
d.not_working();
|
|
d.working();
|
|
}
|
|
|
|
/* #expect: foo.ll
|
|
|
|
define void @foo.Data.not_working(ptr byval(%Data) align 8 %0) #0 {
|
|
entry:
|
|
%1 = insertvalue %"char[]" undef, ptr %0, 0
|
|
%2 = insertvalue %"char[]" %1, i64 32, 1
|
|
ret void
|
|
}
|
|
; Function Attrs: nounwind uwtable
|
|
define void @foo.Data.working(ptr byval(%Data) align 8 %0) #0 {
|
|
entry:
|
|
%1 = insertvalue %"char[]" undef, ptr %0, 0
|
|
%2 = insertvalue %"char[]" %1, i64 32, 1
|
|
ret void
|
|
}
|
|
|