[llvm-bugs] [Bug 49375] New: statically recognizable type-errors result in broken binaries (?)
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Feb 28 11:03:56 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49375
Bug ID: 49375
Summary: statically recognizable type-errors result in broken
binaries (?)
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: heiko.lewin at worldiety.de
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
The following program compiles to a binary where the float is handled before
the int member. VC++ recognizes the error of print() taking rvalue references.
gcc yields the same result clang.
I think such errors should be caught. see https://gcc.godbolt.org/z/G4ddao
struct Test {
int m_x;
float m_y;
template<class Callable>
void withMembers(Callable&& callable) {
callable(m_x, m_y);
}
};
extern void print(int&&i);
extern void print(float&&i);
int notmain()
{
Test t{ .m_x=1, .m_y=2.0f};
t.withMembers([](const auto&... args){
( print(args), ...);
});
return t.m_x;
}
--
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/20210228/e1320494/attachment.html>
More information about the llvm-bugs
mailing list