]> granicus.if.org Git - clang/commit
C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversio...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 13 Jun 2019 19:00:16 +0000 (19:00 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 13 Jun 2019 19:00:16 +0000 (19:00 +0000)
commitd54e3434d4878e8fd87a7dcdfb41aaf62f0e73f8
tree2ed15025d74cd7fed1ebd0cb86c38fbea8e0eeac
parent552d41903d2003e01030581ecc51222be9707e8b
C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression.

Summary:
When a variable is named in a context where we can't directly emit a
reference to it (because we don't know for sure that it's going to be
defined, or it's from an enclosing function and not captured, or the
reference might not "work" for some reason), we emit a copy of the
variable as a global and use that for the known-to-be-read-only access.

Reviewers: rjmccall

Subscribers: jdoerfert, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63157

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363295 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenModule.h
lib/Sema/SemaExpr.cpp
test/CXX/basic/basic.def.odr/p2.cpp [new file with mode: 0644]
test/CXX/drs/dr20xx.cpp
test/CXX/drs/dr21xx.cpp
test/CXX/drs/dr23xx.cpp
test/CXX/drs/dr6xx.cpp
test/CXX/drs/dr7xx.cpp
test/CodeGenCXX/no-odr-use.cpp [new file with mode: 0644]
www/cxx_dr_status.html