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

-Wcast-qual not implemented #5174

Closed
sirainen mannequin opened this issue Aug 27, 2009 · 7 comments
Closed

-Wcast-qual not implemented #5174

sirainen mannequin opened this issue Aug 27, 2009 · 7 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category quality-of-implementation

Comments

@sirainen
Copy link
Mannequin

sirainen mannequin commented Aug 27, 2009

Bugzilla Link 4802
Resolution FIXED
Resolved on Jul 03, 2017 11:14
Version trunk
OS Linux
CC @chengniansun,@DougGregor,@gribozavr,@isanbard,@LebedevRI

Extended Description

int main(void)
{
const char *x = 0;
char *y = (char *)x;
return 0;
}

gcc -Wcast-qual warns:

test.c:4: warning: cast discards qualifiers from pointer target type

clang warns nothing.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 20, 2012

Hi! Following patch adds support for this warning http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120618/059295.html
Please, review.

@isanbard
Copy link
Contributor

Ping?

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 21, 2014

This was (re)implemented in r222568.

@LebedevRI
Copy link
Member

int main(void)
{
const char *x = 0;
char *y = (char *)x;
return 0;
}

gcc -Wcast-qual warns:

test.c:4: warning: cast discards qualifiers from pointer target type

clang warns nothing.

clang-4.0 still does not warn on that.
https://godbolt.org/g/3SEdPm

@LebedevRI
Copy link
Member

Upon further research, it seems that clang's -Wcast-qual does work for C, but unlike gcc's -Wcast-qual, does not do anything in C++.

@LebedevRI
Copy link
Member

Opened https://reviews.llvm.org/D33102
Do not know who to add as reviewers there.

@LebedevRI
Copy link
Member

D33102 has just re-landed.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Nov 3, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category quality-of-implementation
Projects
None yet
Development

No branches or pull requests

3 participants