[llvm-bugs] [Bug 49375] statically recognizable type-errors result in broken binaries (?)
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Feb 28 16:56:55 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49375
Heiko Lewin <heiko.lewin at worldiety.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #2 from Heiko Lewin <heiko.lewin at worldiety.de> ---
Sorry, again. This worked with numbers.
This case prints "floatint" even with my local clang.
I am not proficient enough to be 100% sure if the "const auto&" is allowed to
bind to the "int&& or float&&" but the result is kinda ridiculous.
```
#include <tuple>
struct Test {
int m_x;
float m_y;
template<class Callable>
void withMembers(Callable&& callable) {
callable(m_x, m_y);
}
};
#include <stdio.h>
extern void print(int&&i) {
printf("int");
}
extern void print(float&&i) {
printf("float");
}
int main()
{
Test t{ .m_x=1, .m_y=2.0f};
auto f = [](const int& arg) {
print(arg);
};
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/20210301/b4624482/attachment.html>
More information about the llvm-bugs
mailing list