[LLVMbugs] [Bug 21348] New: -Wignored-qualifier noisy on common pattern
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Oct 22 15:49:55 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=21348
Bug ID: 21348
Summary: -Wignored-qualifier noisy on common pattern
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: chisophugis at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
In libraries that make use of vectors, it is common to parametrize the type
"best type for passing a vector as an argument" (generally either T or T&). I
believe this has to do with ABI and calling convention preferences; why this is
done is not the topic of this bug though. This also can extend to Point classes
which thinly wrap a vector.
For example (using int instead of a vector type):
#if ....
typedef int &IntArg;
#else // (assume this branch isn't taken)
typedef int IntArg;
#endif
int foo(const IntArg I) {
return I * 3;
}
Currently, clang's -Wignored-qualifiers fires on such code due to the const
applying to the &. This means that everywhere that `const IntArg` is used
(which is frequently), -Wignored-qualifiers fires, which is excessively noisy.
I think it would make sense to fire only in the case where the user has
explicitly written a & with a const applied to it.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141022/612a2e70/attachment.html>
More information about the llvm-bugs
mailing list