Open eschnett opened 9 years ago
@llvm/issue-subscribers-c-1
Author: Erik Schnetter (eschnett)
@llvm/issue-subscribers-clang-frontend
Author: Erik Schnetter (eschnett)
@EugeneZelenko clang:to-be-triaged
exists so that I don't flood people who are watching clang:frontend
and clang:diagnostics
with bugs where I haven't done any analysis on. Please refrain from relabeling them.
@Endilll: Sure.
Reproduces with Clang 18.1 and 20.0: https://godbolt.org/z/Yfj4Y4GG1
No lambda related bug, the code boils down to https://godbolt.org/z/hsd96dMvT Should we emit a conversion warning for what is effectively a cast?
Extended Description
In the code below, I create a
shared_ptr<double>
that is ultimately supposed to hold the value-1.0
, yet the actual value is1.84467e+19
. This looks to me as if either wrong code is generated, or as if asize_t
value is accidentally interpreted as double.The code uses
auto
to declare arguments for a lambda expression. If I replace theseauto
manually bysize_t
-- which are they types that should be deduced -- the code works fine.Strangely, the code builds without warnings. If a
size_t
is accidentally interpreted as double, I would have expected a warning.I assume that the deduction of the auto parameters is not working correctly. I may be wrong about this; in this case, I would expect a warning from the compiler about mismatching types.
I am using:
I build with:
The code is: