summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-01-24 22:14:01 +0000
committerEric Fiselier <eric@efcs.ca>2018-01-24 22:14:01 +0000
commit292617e7003efdbc4dd84bc49423dc662f856fb6 (patch)
tree653c72b1f4c5e7b84c7842f812cc0ebeb69a6dec /clang/lib/Sema/TreeTransform.h
parent67abf5396124384be2ad484abd8660bb10dcd94d (diff)
downloadbcm5719-llvm-292617e7003efdbc4dd84bc49423dc662f856fb6.tar.gz
bcm5719-llvm-292617e7003efdbc4dd84bc49423dc662f856fb6.zip
[libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference binding in std::tuple.
Summary: See https://bugs.llvm.org/show_bug.cgi?id=20855 Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example: ``` // The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call. std::tuple<int, const std::string&> t(std::make_tuple(42, "abc")); ``` However, we are over-aggressive and we incorrectly diagnose cases such as: ``` void foo(std::tuple<int const&, int const&> const&); foo(std::make_tuple(42, 42)); ``` This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as: ``` std::tuple<int, const std::string&> t(42, "abc"); ``` Reviewers: rsmith, mclow.lists Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41977 llvm-svn: 323380
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud