[Clang] Fix compare-record.c test on s390x (NFC)
authorNikita Popov <npopov@redhat.com>
Fri, 16 Jun 2023 10:41:23 +0000 (12:41 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 16 Jun 2023 10:43:58 +0000 (12:43 +0200)
s390x looks through pointers when determining the "externally
visible vector ABI". For that reason, the test shows different
behavior just on that platform.

Adjust the test in the reverse direction of what I originall did:
Make sure that the type behind the pointer is always queried, by
dereferencing the pointer.

clang/test/Modules/compare-record.c

index c5ce285..6099869 100644 (file)
@@ -423,10 +423,13 @@ struct CompareDifferentFieldInIndirectStruct compareIndirectStruct;
 // 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