docs: update VDE-016 — v1.0.3 fix insufficient, need fully qualified names
This commit is contained in:
+37
-33
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: VDE-016
|
||||
status: fixed
|
||||
severity: high
|
||||
status: open
|
||||
severity: critical
|
||||
category: bug
|
||||
date: 2026-07-27
|
||||
updated: 2026-07-27
|
||||
@@ -9,49 +9,53 @@ reporter: ViewDesign
|
||||
related: VDE-001, VDE-005, VDE-010
|
||||
---
|
||||
|
||||
# VDE-016: ssi_boolean.cpp 两阶段名称查找修正不完整
|
||||
# VDE-016: ssi_boolean.cpp SSICurveData 名称解析失败
|
||||
|
||||
## 问题描述
|
||||
|
||||
v1.0.2 添加了 `#include <algorithm>`,但仍无法通过 GCC 编译。根本原因是 **匿名命名空间** 在 GCC 两阶段查找下不能被外部引用。
|
||||
v1.0.3 尝试将 `SSICurveData` 移出匿名 namespace、添加 `#include <iterator>` 和 `using vde::brep::ClassResult;`,但 **仍无法通过 GCC 编译**。
|
||||
|
||||
## 剩余编译错误
|
||||
GCC 错误提示 `did you mean 'vde::brep::ClassResult'?` 说明符号可见但非限定名查找失败 — 可能是文件中多处匿名 namespace 嵌套导致的 scope 混淆。
|
||||
|
||||
## 当前编译错误 (v1.0.3)
|
||||
|
||||
```
|
||||
error: 'SSICurveData' was not declared in this scope
|
||||
(it is in vde::brep::{anonymous}::SSICurveData)
|
||||
|
||||
error: 'begin' was not declared in this scope
|
||||
error: 'SSICurveData' was not declared (did you mean 'vde::brep::SSICurveData'?)
|
||||
at: compute_all_ssi() return type, build_face_cutting_planes() parameter
|
||||
error: 'begin' was not declared in this scope (even with #include <iterator>)
|
||||
error: 'end' was not declared in this scope
|
||||
(GCC needs #include <iterator>, MSVC pulls it transitively)
|
||||
|
||||
error: 'ClassResult' was not declared in this scope
|
||||
(should be vde::brep::ClassResult; MSVC allows unqualified lookup)
|
||||
error: 'ClassResult' was not declared (did you mean 'vde::brep::ClassResult'?)
|
||||
at: classify_points() return type
|
||||
```
|
||||
|
||||
## 根因分析
|
||||
## 分析
|
||||
|
||||
1. **SSICurveData** — 定义在 `vde::brep` 命名空间的**匿名 namespace** 中。匿名 namespace 内的类型在翻译单元外部不可见。GCC 严格执行两阶段查找时,放在匿名 namespace 中的类型在其他函数中找不到。**解决方案**:将 `struct SSICurveData` 移出匿名 namespace,放到显式的 `namespace vde::brep` 中。
|
||||
1. **SSICurveData** 的 forward declaration 和定义在 `vde::brep` 命名空间内正确,但 GCC 仍需要全限定名 `vde::brep::SSICurveData` — 可能是文件中多个匿名 namespace 导致对作用域的理解与 MSVC 不同
|
||||
2. **begin/end** — `#include <iterator>` 已添加,仍报错 — 可能是 SSICurveData 错误导致的级联失败
|
||||
3. **ClassResult** — `using vde::brep::ClassResult;` 在 `namespace vde::brep` 内部冗余,无效 — 需直接使用全限定名
|
||||
|
||||
2. **begin/end** — GCC 不会通过 `<algorithm>` 传递引入 `std::begin`/`std::end`,需要显式 `#include <iterator>`。
|
||||
## 建议修复方式
|
||||
|
||||
3. **ClassResult** — 需要 `using vde::brep::ClassResult;`(MSVC 允许隐式查找,GCC 不允许)。
|
||||
将文件中出错的非限定符号改为全限定名:
|
||||
|
||||
```cpp
|
||||
// Line 509:
|
||||
vde::brep::SSICurveData // 替代 SSICurveData
|
||||
|
||||
// Line 612:
|
||||
const std::vector<vde::brep::SSICurveData>& // 替代 SSICurveData
|
||||
|
||||
// Line 643:
|
||||
vde::brep::ClassResult // 替代 ClassResult
|
||||
```
|
||||
|
||||
或在 namespace vde::brep 作用域内、匿名 namespace 之前添加局部 using:
|
||||
```cpp
|
||||
// 在所有匿名 namespace 之前
|
||||
using vde::brep::SSICurveData;
|
||||
using vde::brep::ClassResult;
|
||||
```
|
||||
|
||||
## 当前 Workaround
|
||||
|
||||
ViewDesign 排除 vde_brep 及其依赖(vde_mesh, vde_boolean, vde_sdf, vde_capi)。
|
||||
|
||||
## 建议修复
|
||||
|
||||
```cpp
|
||||
// ssi_boolean.cpp
|
||||
|
||||
// 1. 将 ssi_boolean.cpp 中的匿名命名空间改为显式命名空间:
|
||||
// BEFORE: namespace { struct SSICurveData { ... }; }
|
||||
// AFTER: namespace vde::brep { struct SSICurveData { ... }; }
|
||||
// using namespace vde::brep; // 保持当前代码无需修改
|
||||
|
||||
// 2. 添加 #include <iterator>
|
||||
|
||||
// 3. 添加 using vde::brep::ClassResult;
|
||||
```
|
||||
ViewDesign 排除 vde_brep 及其依赖。
|
||||
|
||||
Reference in New Issue
Block a user