[PR #2733] [CLOSED] fix: remove anonymous namespace from ConfigTypes to fix LTO ODR violation #2926

Closed
opened 2026-10-14 21:06:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2733
Author: @blshkv
Created: 6/15/2026
Status: ❌ Closed

Base: dev ← Head: fix/odr-violation-importcontroller


📝 Commits (1)

  • abb34a5 fix: remove anonymous namespace from ConfigTypes enum in importController.h

📊 Changes

1 file changed (+10 additions, -13 deletions)

View changed files

📝 client/core/controllers/selfhosted/importController.h (+10 -13)

📄 Description

Problem

ConfigTypes is defined inside an anonymous namespace in importController.h, which is included by multiple translation units. When building with LTO and -Werror=odr, the compiler raises:

error: type 'struct ImportController' violates the C++ One Definition Rule [-Werror=odr]
note: type 'ConfigTypes' defined in anonymous namespace cannot match across the translation unit boundary
lto1: some warnings being treated as errors

Anonymous namespaces in headers make every translation unit see the type as distinct, which is an ODR violation under LTO.

Fix

Remove the anonymous namespace wrapper from the ConfigTypes enum. The enum is only used within ImportController, so it can live at file scope without any naming conflict.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2733 **Author:** [@blshkv](https://github.com/blshkv) **Created:** 6/15/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/odr-violation-importcontroller` --- ### 📝 Commits (1) - [`abb34a5`](https://github.com/amnezia-vpn/amnezia-client/commit/abb34a58aa8c19f5b9dff0250e208170ba0d121f) fix: remove anonymous namespace from ConfigTypes enum in importController.h ### 📊 Changes **1 file changed** (+10 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `client/core/controllers/selfhosted/importController.h` (+10 -13) </details> ### 📄 Description ## Problem `ConfigTypes` is defined inside an anonymous namespace in `importController.h`, which is included by multiple translation units. When building with LTO and `-Werror=odr`, the compiler raises: ``` error: type 'struct ImportController' violates the C++ One Definition Rule [-Werror=odr] note: type 'ConfigTypes' defined in anonymous namespace cannot match across the translation unit boundary lto1: some warnings being treated as errors ``` Anonymous namespaces in headers make every translation unit see the type as distinct, which is an ODR violation under LTO. ## Fix Remove the anonymous namespace wrapper from the `ConfigTypes` enum. The enum is only used within `ImportController`, so it can live at file scope without any naming conflict. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-14 21:06:14 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#2926
No description provided.