[llvm-bugs] [Bug 46969] New: clang-format splits >> (bitshift) into > > (and thus breaks code)
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 3 09:31:43 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46969
Bug ID: 46969
Summary: clang-format splits >> (bitshift) into > > (and thus
breaks code)
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: freitsabes at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
Consider this code:
class MyClass
{
public:
MyClass();
~MyClass();
short z;
};
MyClass::MyClass(){}
MyClass::~MyClass(){}
int main(int, const char**)
{
MyClass* s = new MyClass;
s->z = 5;
for (int j = 0; j < (int)s->z >> 1; ++j) // HERE IS THE IMPORTANT PART
{
// do nothing
}
return 0;
}
clang-format, with default settings, formats this into:
class MyClass {
public:
MyClass();
~MyClass();
short z;
};
MyClass::MyClass() {}
MyClass::~MyClass() {}
int main(int, const char **) {
MyClass *s = new MyClass;
s->z = 5;
for (int j = 0; j<(int)s->z> > 1; ++j) { // HERE IS THE IMPORTANT PART
// do nothing
}
return 0;
}
After the formatting, it does no longer compile.
--
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/20200803/ce55b89d/attachment.html>
More information about the llvm-bugs
mailing list