diff options
Diffstat (limited to 'clang/test/Modules')
-rw-r--r-- | clang/test/Modules/odr_hash.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp index 652e74f9569..2b2a788efc7 100644 --- a/clang/test/Modules/odr_hash.cpp +++ b/clang/test/Modules/odr_hash.cpp @@ -115,6 +115,41 @@ S4 s4; #endif } +namespace Field { +#if defined(FIRST) +struct S1 { + int x; + private: + int y; +}; +#elif defined(SECOND) +struct S1 { + int x; + int y; +}; +#else +S1 s1; +// 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) +struct S2 { + int x; + int y; +}; +#elif defined(SECOND) +struct S2 { + int y; + int x; +}; +#else +S2 s2; +// 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'}} +#endif +} // namespace Field + // Naive parsing of AST can lead to cycles in processing. Ensure // self-references don't trigger an endless cycles of AST node processing. namespace SelfReference { @@ -151,6 +186,9 @@ struct S { static_assert(1 == 1, "Message"); static_assert(2 == 2); + + int x; + double y; }; #elif defined(SECOND) struct S { @@ -160,6 +198,9 @@ struct S { static_assert(1 == 1, "Message"); static_assert(2 == 2); + + int x; + double y; }; #else S s; @@ -174,6 +215,9 @@ struct T { static_assert(1 == 1, "Message"); static_assert(2 == 2); + int x; + double y; + private: }; #elif defined(SECOND) @@ -185,6 +229,9 @@ struct T { static_assert(1 == 1, "Message"); static_assert(2 == 2); + int x; + double y; + public: }; #else |