aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/reference-init.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-29 19:14:02 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-29 19:14:02 +0000
commit65eb86e91252791cea630e6ebcae8a5099aa24cf (patch)
treeca2793fc194e63fccb23ffd77c1b4fe1b4a98add /clang/test/CodeGenCXX/reference-init.cpp
parent9fb8ce835d80337669f24fe7f567da015639d84f (diff)
downloadllvm-65eb86e91252791cea630e6ebcae8a5099aa24cf.zip
llvm-65eb86e91252791cea630e6ebcae8a5099aa24cf.tar.gz
llvm-65eb86e91252791cea630e6ebcae8a5099aa24cf.tar.bz2
Fix reference binding of const lvalue references to bit-fields, which
requires a temporary. Previously, we were building an initialization sequence that bound to the bit-field as if it were a real lvalue. Note that we previously (and still) diagnose binding of non-const references to bit-fields, as we should. There's no real way to test that this code is correct, since reference binding does not *currently* have any representation in the AST. This fix should make it easier for that to happen, so I've verified this fix with... Added InitializationSequence::dump(), to print an initialization sequence for debugging purposes. llvm-svn: 94826
Diffstat (limited to 'clang/test/CodeGenCXX/reference-init.cpp')
-rw-r--r--clang/test/CodeGenCXX/reference-init.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/reference-init.cpp b/clang/test/CodeGenCXX/reference-init.cpp
index 61ae2da..9469c84 100644
--- a/clang/test/CodeGenCXX/reference-init.cpp
+++ b/clang/test/CodeGenCXX/reference-init.cpp
@@ -19,3 +19,6 @@ namespace PR5911 {
struct Foo { int foo; };
Foo& ignoreSetMutex = *(new Foo);
+// Binding to a bit-field that requires a temporary.
+struct { int bitfield : 3; } s = { 3 };
+const int &s2 = s.bitfield;