// expected-error@second.h:* {{'AccessSpecifiers::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found end of class}}
#endif
#if defined(FIRST)
structS2{
public:
};
#elif defined(SECOND)
structS2{
protected:
};
#else
S2s2;
// expected-error@second.h:* {{'AccessSpecifiers::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found protected access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}}
// expected-error@second.h:* {{'StaticAssert::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with message}}
// expected-note@first.h:* {{but in 'FirstModule' found static assert with different message}}
#endif
#if defined(FIRST)
structS2{
static_assert(2==2,"Message");
};
#elif defined(SECOND)
structS2{
static_assert(2==2);
};
#else
S2s2;
// expected-error@second.h:* {{'StaticAssert::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with no message}}
// expected-note@first.h:* {{but in 'FirstModule' found static assert with message}}
#endif
#if defined(FIRST)
structS3{
static_assert(3==3,"Message");
};
#elif defined(SECOND)
structS3{
static_assert(3!=4,"Message");
};
#else
S3s3;
// expected-error@second.h:* {{'StaticAssert::S3' has different definitions in different modules; first difference is definition in module 'SecondModule' found static assert with condition}}
// expected-note@first.h:* {{but in 'FirstModule' found static assert with different condition}}
#endif
#if defined(FIRST)
structS4{
static_assert(4==4,"Message");
};
#elif defined(SECOND)
structS4{
public:
};
#else
S4s4;
// expected-error@second.h:* {{'StaticAssert::S4' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found static assert}}
// expected-error@second.h:* {{'Field::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found field}}
// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
#endif
#if defined(FIRST)
structS2{
intx;
inty;
};
#elif defined(SECOND)
structS2{
inty;
intx;
};
#else
S2s2;
// expected-error@second.h:* {{'Field::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found field 'y'}}
// expected-note@first.h:* {{but in 'FirstModule' found field 'x'}}
// expected-error@second.h:* {{'AllDecls::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
#endif
}
namespaceFriendFunction{
#if defined(FIRST)
voidF(int=0);
structS{friendvoidF(int);};
#elif defined(SECOND)
voidF(int);
structS{friendvoidF(int);};
#else
Ss;
#endif
#if defined(FIRST)
voidG(int=0);
structT{
friendvoidG(int);
private:
};
#elif defined(SECOND)
voidG(int);
structT{
friendvoidG(int);
public:
};
#else
Tt;
// expected-error@second.h:* {{'FriendFunction::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
#endif
}// namespace FriendFunction
namespaceImplicitDecl{
#if defined(FIRST)
structS{};
voidS_Constructors(){
// Trigger creation of implicit contructors
Sfoo;
Sbar=foo;
Sbaz(bar);
}
#elif defined(SECOND)
structS{};
#else
Ss;
#endif
#if defined(FIRST)
structT{
private:
};
voidT_Constructors(){
// Trigger creation of implicit contructors
Tfoo;
Tbar=foo;
Tbaz(bar);
}
#elif defined(SECOND)
structT{
public:
};
#else
Tt;
// expected-error@first.h:* {{'ImplicitDecl::T' has different definitions in different modules; first difference is definition in module 'FirstModule' found private access specifier}}
// expected-note@second.h:* {{but in 'SecondModule' found public access specifier}}
#endif
}// namespace ImplicitDelc
namespaceTemplatedClass{
#if defined(FIRST)
template<class>
structS{};
#elif defined(SECOND)
template<class>
structS{};
#else
S<int>s;
#endif
#if defined(FIRST)
template<class>
structT{
private:
};
#elif defined(SECOND)
template<class>
structT{
public:
};
#else
T<int>t;
// expected-error@second.h:* {{'TemplatedClass::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
#endif
}// namespace TemplatedClass
namespaceTemplateClassWithField{
#if defined(FIRST)
template<classA>
structS{
Aa;
};
#elif defined(SECOND)
template<classA>
structS{
Aa;
};
#else
S<int>s;
#endif
#if defined(FIRST)
template<classA>
structT{
Aa;
private:
};
#elif defined(SECOND)
template<classA>
structT{
Aa;
public:
};
#else
T<int>t;
// expected-error@second.h:* {{'TemplateClassWithField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found public access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found private access specifier}}
#endif
}// namespace TemplateClassWithField
namespaceTemplateClassWithTemplateField{
#if defined(FIRST)
template<classA>
classWrapperS;
template<classA>
structS{
WrapperS<A>a;
};
#elif defined(SECOND)
template<classA>
classWrapperS;
template<classA>
structS{
WrapperS<A>a;
};
#else
template<classA>
classWrapperS{};
S<int>s;
#endif
#if defined(FIRST)
template<classA>
classWrapperT;
template<classA>
structT{
WrapperT<A>a;
public:
};
#elif defined(SECOND)
template<classA>
classWrapperT;
template<classA>
structT{
WrapperT<A>a;
private:
};
#else
template<classA>
classWrapperT{};
T<int>t;
// expected-error@second.h:* {{'TemplateClassWithTemplateField::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}}
#endif
}// namespace TemplateClassWithTemplateField
namespaceEnumWithForwardDeclaration{
#if defined(FIRST)
enumE:int;
structS{
voidget(E){}
};
#elif defined(SECOND)
enumE:int{A,B};
structS{
voidget(E){}
};
#else
Ss;
#endif
#if defined(FIRST)
structT{
voidget(E){}
public:
};
#elif defined(SECOND)
structT{
voidget(E){}
private:
};
#else
Tt;
// expected-error@second.h:* {{'EnumWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}}
#endif
}// namespace EnumWithForwardDeclaration
namespaceStructWithForwardDeclaration{
#if defined(FIRST)
structP{};
structS{
structP*ptr;
};
#elif defined(SECOND)
structS{
structP*ptr;
};
#else
Ss;
#endif
#if defined(FIRST)
structQ{};
structT{
structQ*ptr;
public:
};
#elif defined(SECOND)
structT{
structQ*ptr;
private:
};
#else
Tt;
// expected-error@second.h:* {{'StructWithForwardDeclaration::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}}
// expected-error@second.h:* {{'StructWithForwardDeclarationNoDefinition::T' has different definitions in different modules; first difference is definition in module 'SecondModule' found private access specifier}}
// expected-note@first.h:* {{but in 'FirstModule' found public access specifier}}