diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,7 @@
+### 0.22.4
+
++ Do not generate bindings for struct/union fields pointing to private/class structs, which we do not bind.
+
 ### 0.22.3
 
 + Sometimes struct fields marked as not introspectable contain invalid introspection info. We are lenient in these cases with parsing errors, and simply ignore the fields.
diff --git a/haskell-gi.cabal b/haskell-gi.cabal
--- a/haskell-gi.cabal
+++ b/haskell-gi.cabal
@@ -1,5 +1,5 @@
 name:                haskell-gi
-version:             0.22.3
+version:             0.22.4
 synopsis:            Generate Haskell bindings for GObject Introspection capable libraries
 description:         Generate Haskell bindings for GObject Introspection capable libraries. This includes most notably
                      Gtk+, but many other libraries in the GObject ecosystem provide introspection data too.
diff --git a/lib/Data/GI/CodeGen/CabalHooks.hs b/lib/Data/GI/CodeGen/CabalHooks.hs
--- a/lib/Data/GI/CodeGen/CabalHooks.hs
+++ b/lib/Data/GI/CodeGen/CabalHooks.hs
@@ -73,7 +73,11 @@
   let em' = map (MN.fromString . T.unpack) (listModuleTree m)
       lib = ((condTreeData . fromJust . condLibrary) gpd)
       bi = libBuildInfo lib
+#if MIN_VERSION_base(4,11,0)
       bi' = bi {autogenModules = em'}
+#else
+      bi' = bi
+#endif
       lib' = lib {exposedModules = em', libBuildInfo = bi'}
       cL' = ((fromJust . condLibrary) gpd) {condTreeData = lib'}
       gpd' = gpd {condLibrary = Just cL'}
diff --git a/lib/Data/GI/CodeGen/Struct.hs b/lib/Data/GI/CodeGen/Struct.hs
--- a/lib/Data/GI/CodeGen/Struct.hs
+++ b/lib/Data/GI/CodeGen/Struct.hs
@@ -32,6 +32,17 @@
 ignoreStruct (Name _ name) s = isJust (gtypeStructFor s) ||
                                "Private" `T.isSuffixOf` name
 
+-- | Whether the given type corresponds to an ignored struct.
+isIgnoredStructType :: Type -> CodeGen Bool
+isIgnoredStructType t =
+  case t of
+    TInterface n -> do
+      api <- getAPI t
+      case api of
+        APIStruct s -> return (ignoreStruct n s)
+        _ -> return False
+    _ -> return False
+
 -- | Canonical name for the type of a callback type embedded in a
 -- struct field.
 fieldCallbackType :: Text -> Field -> Text
@@ -297,12 +308,20 @@
 
   return $ "'(\"" <> labelName field <> "\", " <> it <> ")"
 
+-- | Build code for a single field.
 buildFieldAttributes :: Name -> Field -> ExcCodeGen (Maybe Text)
 buildFieldAttributes n field
     | not (fieldVisible field) = return Nothing
     | privateType (fieldType field) = return Nothing
     | otherwise = group $ do
 
+     -- We don't generate bindings for private and class structs, so
+     -- do not generate bindings for fields pointing to class structs
+     -- either.
+     ignored <- isIgnoredStructType (fieldType field)
+     when ignored $
+      notImplementedError "Field type is an unsupported struct type"
+
      nullPtr <- nullPtrForType (fieldType field)
 
      embedded <- isEmbedded field
@@ -330,6 +349,7 @@
 
           docSection = NamedSubsection PropertySection $ lcFirst $ fName field
 
+-- | Generate code for the given list of fields.
 genStructOrUnionFields :: Name -> [Field] -> CodeGen ()
 genStructOrUnionFields n fields = do
   let name' = upperName n
