https://llvm.org/bugs/show_bug.cgi?id=28776
Bug ID: 28776
Summary: Warn for implicit conversion from char literal to int
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
This is related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55254&list_id=139817
I sometimes want to construct a string with n copies of a char c. However, I
frequently get the order of elements in the constructor mixed up. Rather than
saying std::string(80, '='), I accidentally call std::string('=', 80). If I go
through the trouble to put something in single quotes, I probably mean to pass
it to something expecting a char, not an integer.
Ultimately, I want to get a warning for this code:
#include <string>
int main() {
std::string const probably_wrong('0', 80);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs