mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 15:28:53 -04:00

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
25 lines
635 B
C++
25 lines
635 B
C++
// RUN: %clang_cc1 -emit-llvm-only -verify %s
|
|
|
|
struct XPTParamDescriptor {};
|
|
struct nsXPTParamInfo {
|
|
nsXPTParamInfo(const XPTParamDescriptor& desc);
|
|
};
|
|
void a(XPTParamDescriptor *params) {
|
|
const nsXPTParamInfo& paramInfo = params[0];
|
|
}
|
|
|
|
// CodeGen of reference initialized const arrays.
|
|
namespace PR5911 {
|
|
template <typename T, int N> int f(const T (&a)[N]) { return N; }
|
|
int iarr[] = { 1 };
|
|
int test() { return f(iarr); }
|
|
}
|
|
|
|
// radar 7574896
|
|
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;
|