diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt index 48cf21a951d..a7bd605846c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CacheSupport.kt @@ -114,5 +114,10 @@ class CacheSupport( "that is already cached in '${cache.path}'") } } + + if ((librariesToCache.isNotEmpty() || cachedLibraries.hasDynamicCaches || cachedLibraries.hasStaticCaches) + && configuration.getBoolean(KonanConfigKeys.OPTIMIZATION)) { + configuration.reportCompilationError("Cache cannot be used in optimized compilation") + } } } \ No newline at end of file