-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error when slicing a struct with an inline array #1488.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
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
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,34 @@ | ||
// #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 | ||
} | ||
|