DR1295 and cleanup for P0135R1: Make our initialization code more directly
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 9 Dec 2016 18:49:13 +0000 (18:49 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 9 Dec 2016 18:49:13 +0000 (18:49 +0000)
commitb8c0f553ed6b7e52b12afa00ace3e30754482037
tree17b50394cbd2219fdb1717c18dc437df586b12be
parent0c1c3bbc78e4548831e307c0e527449254a2bbbb
DR1295 and cleanup for P0135R1: Make our initialization code more directly
mirror the description in the standard. Per DR1295, this means that binding a
const / rvalue reference to a bit-field no longer "binds directly", and per
P0135R1, this means that we materialize a temporary in reference binding
after adjusting cv-qualifiers and before performing a derived-to-base cast.

In C++11 onwards, this should have fixed the last case where we would
materialize a temporary of the wrong type (with a subobject adjustment inside
the MaterializeTemporaryExpr instead of outside), but we still have to deal
with that possibility in C++98, unless we want to start using xvalues to
represent materialized temporaries there too.

llvm-svn: 289250
15 files changed:
clang/include/clang/Sema/Initialization.h
clang/lib/AST/ExprConstant.cpp
clang/lib/Analysis/CFG.cpp
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
clang/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
clang/test/CXX/drs/dr12xx.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/constant-expression-cxx1z.cpp
clang/test/SemaCXX/member-init.cpp
clang/test/SemaCXX/microsoft-new-delete.cpp
clang/test/SemaCXX/reinterpret-cast.cpp