Skip to content

Conversation

@j-hui
Copy link
Contributor

@j-hui j-hui commented Nov 4, 2025

Clang is helpfully telling us that one of the base types is inaccessible, except we don't really care about that because we are only using this type for testing other diagnostics. That warning is getting caught by the newly comprehensive swiftc diagnostic verifier, so we suppress it with a Clang pragma.

rdar://163875420

Clang is helpfully telling us that one of the base types is
inaccessible, except we don't really care about that because we are
only using this type for testing other diagnostics. That warning is
getting caught by the newly comprehensive swiftc diagnostic verifier,
so we suppress it with a Clang pragma.

rdar://163875420
@j-hui
Copy link
Contributor Author

j-hui commented Nov 4, 2025

We were previously getting:

<module-includes>:1:9: error: unexpected note produced: in file included from <module-includes>:1:
#import "inheritance.h"
        ^
<module-includes>:1:9: note: file '<module-includes>' is not parsed for 'expected' statements. Use '-verify-additional-file <module-includes>' to enable, or '-verify-ignore-unrelated' to ignore diagnostics in this file
#import "inheritance.h"
        ^
/Users/local/jenkins/workspace/fs-swift-main-tools_RA-stdlib_RDA-apple-silicon/swift/test/Interop/Cxx/foreign-reference/Inputs/inheritance.h:291:12: error: unexpected warning produced: direct base 'B1' is inaccessible due to ambiguity:
    struct MultipleInheritanceExample3::D -> B1
    struct MultipleInheritanceExample3::D -> B3 -> B1
struct D : B1, B2, B3 {}; // expected-warning {{unable to infer SWIFT_SHARED_REFERENCE for 'D', although one of its transitive base types is marked as SWIFT_SHARED_REFERENCE}}
           ^
/Users/local/jenkins/workspace/fs-swift-main-tools_RA-stdlib_RDA-apple-silicon/swift/test/Interop/Cxx/foreign-reference/Inputs/inheritance.h:291:12: note: file '/Users/local/jenkins/workspace/fs-swift-main-tools_RA-stdlib_RDA-apple-silicon/swift/test/Interop/Cxx/foreign-reference/Inputs/inheritance.h' is not parsed for 'expected' statements. Use '-verify-additional-file /Users/local/jenkins/workspace/fs-swift-main-tools_RA-stdlib_RDA-apple-silicon/swift/test/Interop/Cxx/foreign-reference/Inputs/inheritance.h' to enable, or '-verify-ignore-unrelated' to ignore diagnostics in this file
struct D : B1, B2, B3 {}; // expected-warning {{unable to infer SWIFT_SHARED_REFERENCE for 'D', although one of its transitive base types is marked as SWIFT_SHARED_REFERENCE}}
           ^
<module-includes>:1:9: note: diagnostic produced elsewhere: in file included from <module-includes>:1:
#import "inheritance.h"
        ^
/Users/local/jenkins/workspace/fs-swift-main-tools_RA-stdlib_RDA-apple-silicon/swift/test/Interop/Cxx/foreign-reference/Inputs/inheritance.h:291:12: warning: diagnostic produced elsewhere: direct base 'B1' is inaccessible due to ambiguity:
    struct MultipleInheritanceExample3::D -> B1
    struct MultipleInheritanceExample3::D -> B3 -> B1
struct D : B1, B2, B3 {}; // expected-warning {{unable to infer SWIFT_SHARED_REFERENCE for 'D', although one of its transitive base types is marked as SWIFT_SHARED_REFERENCE}}
           ^

--

The aim of this PR is address that.

@j-hui
Copy link
Contributor Author

j-hui commented Nov 4, 2025

Alternative approach is to just throw -verify-ignore-unrelated into the command line invocation, but we should not force all tests that import this header file to do so.

Another solution would be to just fix up this test case to not be weird, but using a pragma seemed easier and keeps the test simple.

@j-hui
Copy link
Contributor Author

j-hui commented Nov 4, 2025

@swift-ci please smoke test

@j-hui j-hui merged commit 1e446b4 into swiftlang:main Nov 5, 2025
3 checks passed
elsakeirouz pushed a commit to elsakeirouz/swift that referenced this pull request Nov 6, 2025
…#85302)

Clang is helpfully telling us that one of the base types is
inaccessible, except we don't really care about that because we are only
using this type for testing other diagnostics. That warning is getting
caught by the newly comprehensive swiftc diagnostic verifier, so we
suppress it with a Clang pragma.

rdar://163875420
elsakeirouz pushed a commit to elsakeirouz/swift that referenced this pull request Nov 6, 2025
…#85302)

Clang is helpfully telling us that one of the base types is
inaccessible, except we don't really care about that because we are only
using this type for testing other diagnostics. That warning is getting
caught by the newly comprehensive swiftc diagnostic verifier, so we
suppress it with a Clang pragma.

rdar://163875420
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants