Commit a23b621
util/attributes: Error on #[repr] applied to functions
The #[repr] attribute is only valid for structs, enums, and unions.
Applying it to a function is invalid and should result in an error.
This patch adds a check in the attribute visitor to reject #[repr]
on functions, matching rustc behavior.
Fixes #4232
gcc/rust/ChangeLog:
* util/rust-attributes.cc (AttributeChecker::check_attributes): Emit error for #[repr].
gcc/testsuite/ChangeLog:
* rust/compile/issue-4232.rs: New test.
Signed-off-by: Jayant Chauhan <[email protected]>1 parent 3d11639 commit a23b621
File tree
2 files changed
+9
-0
lines changed- gcc
- rust/util
- testsuite/rust/compile
2 files changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
915 | 921 | | |
916 | 922 | | |
917 | 923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments