DR1213: element access on an array xvalue or prvalue produces an xvalue. In the
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 5 Dec 2016 07:49:14 +0000 (07:49 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 5 Dec 2016 07:49:14 +0000 (07:49 +0000)
commitb3189a1802e493fd819b766c2051bda04f18617c
treef2f4135e179e717581ffdc0ad34d708376db62bd
parent215ff84b4082bea94dbf065d5fbac3cdd7f69516
DR1213: element access on an array xvalue or prvalue produces an xvalue. In the
latter case, a temporary array object is materialized, and can be
lifetime-extended by binding a reference to the member access. Likewise, in an
array-to-pointer decay, an rvalue array is materialized before being converted
into a pointer.

This caused IR generation to stop treating file-scope array compound literals
as having static storage duration in some cases in C++; that has been rectified
by modeling such a compound literal as an lvalue. This also improves clang's
compatibility with GCC for those cases.

llvm-svn: 288654
13 files changed:
clang/lib/AST/ExprClassification.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
clang/test/Analysis/explain-svals.cpp
clang/test/CXX/drs/dr12xx.cpp
clang/test/CodeGenCXX/compound-literals.cpp
clang/test/CodeGenCXX/stack-reuse.cpp
clang/test/CodeGenCXX/temporaries.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/www/cxx_dr_status.html