// expected-error@second-nested-struct.h:* {{'IndirectStruct::mismatchingField' from module 'Second' is not present in definition of 'struct IndirectStruct' in module 'First.Hidden'}}
// expected-note@first-nested-struct.h:* {{declaration of 'mismatchingField' does not match}}
#elif defined(CASE3)
-// This currently doesn't produce an error, because there is no dependency
-// on the layout of DirectStruct.
-// expected-no-diagnostics
+// expected-error@second-nested-struct.h:* {{'IndirectStruct::mismatchingField' from module 'Second' is not present in definition of 'struct IndirectStruct' in module 'First.Hidden'}}
+// expected-note@first-nested-struct.h:* {{declaration of 'mismatchingField' does not match}}
struct CompareIndirectStructPointer compareIndirectStructPointer;
+struct DirectStruct test() {
+ // Make sure the type behind the pointer is inspected.
+ return *compareIndirectStructPointer.directFieldPointer;
+}
#endif
//--- include/first-anonymous.h