-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cgen: cast 'vstring'.str
to char *
if it is the expected type
#19827
Changes from all commits
4eae9c6
1cc3701
585a767
1847a7f
be9a9c9
1034487
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
barbaz |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn foo(bar &char, baz &char) { | ||
println(unsafe { bar.vstring() + baz.vstring() }) | ||
} | ||
|
||
fn main() { | ||
baz := 'baz'.str | ||
// Should compile with `-cc [gcc/clang] -cstrict` | ||
foo('bar'.str, baz) | ||
} | ||
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it should not compile with -cstrict. Such hacks are brittle. It should need explicit casts, like this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but why should the user do the explicit cast with flags? I feel they don't need to do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what flags are you talking about? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The user should have done the explicit cast in all cases, |
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.
Fixing this to use
&u8
where types are declared asunsigned char *
allows for green CI.v/thirdparty/mbedtls/include/mbedtls/pk.h
Lines 793 to 795 in e59c194