Skip to content
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

fix Issue 22411 - importC: Error: cannot implicitly convert expression of type 'const(char*)' to 'char*' #13186

Merged
merged 1 commit into from Oct 19, 2021

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Oct 17, 2021

GCC complains about discarding qualifiers in the const char* case, but otherwise it is completely valid.

@ibuclaw ibuclaw added Bug Fix ImportC Pertaining to ImportC support labels Oct 17, 2021
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Auto-close Bugzilla Severity Description
22411 major importC: Error: cannot implicitly convert expression of type 'const(char*)' to 'char*'

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#13186"

@ibuclaw ibuclaw force-pushed the issue22411 branch 3 times, most recently from fc33b2c to 0a56571 Compare October 18, 2021 23:25
@ibuclaw
Copy link
Member Author

ibuclaw commented Oct 19, 2021

Relaxed the rule even further. C11 6.3.2.3-7 says "A pointer to an object type may be converted to a pointer to a different object type". To which C compilers seem to interpret this as "all pointers can be implicitly converted to any other pointer".

Again, gcc warns about such code, but otherwise it's completely valid in the UB realm.

@RazvanN7 RazvanN7 merged commit ba95002 into dlang:stable Oct 19, 2021
@ibuclaw ibuclaw deleted the issue22411 branch October 20, 2021 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Bug Fix ImportC Pertaining to ImportC support
Projects
None yet
5 participants