xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/reference-init.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -verify %s
2f4a2713aSLionel Sambuc // expected-no-diagnostics
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc struct XPTParamDescriptor {};
5f4a2713aSLionel Sambuc struct nsXPTParamInfo {
6f4a2713aSLionel Sambuc   nsXPTParamInfo(const XPTParamDescriptor& desc);
7f4a2713aSLionel Sambuc };
a(XPTParamDescriptor * params)8f4a2713aSLionel Sambuc void a(XPTParamDescriptor *params) {
9f4a2713aSLionel Sambuc   const nsXPTParamInfo& paramInfo = params[0];
10f4a2713aSLionel Sambuc }
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc // CodeGen of reference initialized const arrays.
13f4a2713aSLionel Sambuc namespace PR5911 {
f(const T (& a)[N])14f4a2713aSLionel Sambuc   template <typename T, int N> int f(const T (&a)[N]) { return N; }
15f4a2713aSLionel Sambuc   int iarr[] = { 1 };
test()16f4a2713aSLionel Sambuc   int test() { return f(iarr); }
17f4a2713aSLionel Sambuc }
18f4a2713aSLionel Sambuc 
19f4a2713aSLionel Sambuc // radar 7574896
20f4a2713aSLionel Sambuc struct Foo { int foo; };
21f4a2713aSLionel Sambuc Foo& ignoreSetMutex = *(new Foo);
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc // Binding to a bit-field that requires a temporary.
24f4a2713aSLionel Sambuc struct { int bitfield : 3; } s = { 3 };
25f4a2713aSLionel Sambuc const int &s2 = s.bitfield;
26