Uploaded image for project: 'Swift'
  1. Swift
  2. SR-805

Generated header is missing imports in C++ mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
    • Environment:

      Xcode 7.2.1

      Description

      The generated '

      {modulename}-Swift.h' file fails to compile when 3 or more modules are involved with the following configuration:

      1. FrameworkA has an Objective-C class 'ClassA'.
      2. FrameworkB has a Swift class 'ClassB' subclassing 'ClassA' with an '@objc' annotation of a different name ('FrameworkBClassB').
      3. FrameworkC has a Swift subclass 'ClassC' subclassing 'ClassB' and an Objective-C++ file importing the Xcode-generated (via PrintAsObjC) '{modulename}

      -Swift.h'.

      FrameworkC fails to compile in this case. If the '.mm' file is renamed to '.m', FrameworkC compiles. If the '-Swift.h' file isn't imported, FrameworkC compiles.

      You'd be forgiven to assume that this is an arcane configuration that would never happen in practice, but you'd be wrong (cue nervous laughter). See https://github.com/realm/realm-cocoa/issues/3073

      I've attached a sample Xcode project, to reproduce this issue, just build the FrameworkC target using Xcode 7.2.1.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jpsim JP Simard
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: