[llvm-bugs] [Bug 44967] New: clang-format misinterprets binary operator & as reference in boost serialization
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 19 12:54:30 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44967
Bug ID: 44967
Summary: clang-format misinterprets binary operator & as
reference in boost serialization
Product: clang
Version: 10.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangbugs at nondot.org
Reporter: andre.brand at mailbox.org
CC: djasper at google.com, klimek at google.com,
llvm-bugs at lists.llvm.org
This is a common (simplified) pattern for boost serialization:
struct Vec2d {
float x;
float y;
};
template <class Archive>
void serialize(Archive& a, Vec2d& v) {
a & v.x;
a & v.y;
}
There are different implementations of Archive that define the binary operator
&. But clang-format tends to interpret it as a reference:
$ clang-format myvector.h -style="{BasedOnStyle: llvm, PointerAlignment: Left}"
struct Vec2d {
float x;
float y;
};
template <class Archive>
void serialize(Archive& a, Vec2d& v) {
a& v.x;
a& v.y;
}
$ clang-format myvector.h -style="{BasedOnStyle: llvm, PointerAlignment:
Right}"
struct Vec2d {
float x;
float y;
}
template <class Archive>
void serialize(Archive &a, Vec2d &v) {
a &v.x;
a &v.y;
}
--
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/20200219/f6f58600/attachment.html>
More information about the llvm-bugs
mailing list