structF:A,E{};// expected-warning {{direct base 'A' is inaccessible due to ambiguity}}
structG:virtualA{};
structH:E,G{};
structI{inti;};
structJ:I{};
structK:I,virtualJ{};// expected-warning {{direct base 'MultipleClasses::I' is inaccessible due to ambiguity}}
structL:virtualJ{};
structM:virtualJ,L{};
voidtest(){
auto[b]=B();// expected-error {{cannot decompose class type 'B': both it and its base class 'A' have non-static data members}}
auto[d]=D();// expected-error {{cannot decompose class type 'D': its base classes 'A' and 'MultipleClasses::C' have non-static data members}}
auto[e]=E();
auto[f]=F();// expected-error-re {{cannot decompose members of ambiguous base class 'A' of 'F':{{.*}}struct MultipleClasses::F -> struct A{{.*}}struct MultipleClasses::F -> struct MultipleClasses::E -> struct A}}
auto[h]=H();// ok, only one (virtual) base subobject even though there are two paths to it
auto[k]=K();// expected-error {{cannot decompose members of ambiguous base class 'MultipleClasses::I'}}
auto[m]=M();// ok, all paths to I are through the same virtual base subobject J
same<decltype(m),int>();
}
}
namespaceBindingTypes{
structA{
inti=0;
int&r=i;
constfloatf=i;
mutablevolatileintmvi;
};
voide(){
auto[i,r,f,mvi]=A();
same<decltype(i),int>();
same<decltype(r),int&>();
same<decltype(f),constfloat>();
same<decltype(mvi),volatileint>();
same<decltype((i)),int&>();
same<decltype((r)),int&>();
same<decltype((f)),constfloat&>();
same<decltype((mvi)),volatileint&>();
}
voidf(){
auto&&[i,r,f,mvi]=A();
same<decltype(i),int>();
same<decltype(r),int&>();
same<decltype(f),constfloat>();
same<decltype(mvi),volatileint>();
same<decltype((i)),int&>();
same<decltype((r)),int&>();
same<decltype((f)),constfloat&>();
same<decltype((mvi)),volatileint&>();
}
voidg(){
constauto[i,r,f,mvi]=A();
same<decltype(i),constint>();
same<decltype(r),int&>();
same<decltype(f),constfloat>();
same<decltype(mvi),volatileint>();// not 'const volatile int', per expected resolution of DRxxx
same<decltype((i)),constint&>();
same<decltype((r)),int&>();
same<decltype((f)),constfloat&>();
same<decltype((mvi)),volatileint&>();// not 'const volatile int&', per expected resolution of DRxxx
}
voidh(){
typedefconstACA;
auto&[i,r,f,mvi]=CA();// type of var is 'const A &'
same<decltype(i),constint>();// not 'int', per expected resolution of DRxxx
same<decltype(r),int&>();
same<decltype(f),constfloat>();
same<decltype(mvi),volatileint>();// not 'const volatile int', per expected resolution of DRxxx
same<decltype((i)),constint&>();// not 'int&', per expected resolution of DRxxx
same<decltype((r)),int&>();
same<decltype((f)),constfloat&>();
same<decltype((mvi)),volatileint&>();// not 'const volatile int&', per expected resolution of DRxxx