Restructure checking for, and warning on, lifetime extension.
This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.
This reinstates r337226, reverted in r337255, with a fix for the
InitializedEntity alignment problem that was breaking ARM buildbots.
llvm-svn: 337329
diff --git a/clang/test/SemaCXX/eval-crashes.cpp b/clang/test/SemaCXX/eval-crashes.cpp
index 2394684..33bde75 100644
--- a/clang/test/SemaCXX/eval-crashes.cpp
+++ b/clang/test/SemaCXX/eval-crashes.cpp
@@ -26,10 +26,10 @@
namespace pr33140_2 {
// FIXME: The declaration of 'b' below should lifetime-extend two int
- // temporaries, invalidating this warning to some extent.
- struct A { int &&r = 0; }; // expected-warning {{binding reference member 'r' to a temporary}} expected-note {{here}}
+ // temporaries.
+ struct A { int &&r = 0; }; // expected-warning 2{{not supported}}
struct B { A x, y; };
- B b = {};
+ B b = {}; // expected-note 2{{used here}}
}
namespace pr33140_3 {