diff --git a/docs/feedback/VDE-016.md b/docs/feedback/VDE-016.md index 082465c..dd7b2c9 100644 --- a/docs/feedback/VDE-016.md +++ b/docs/feedback/VDE-016.md @@ -1,6 +1,6 @@ --- id: VDE-016 -status: fixed +status: open severity: critical category: bug date: 2026-07-27 @@ -9,51 +9,62 @@ reporter: ViewDesign related: VDE-001, VDE-005, VDE-010 --- -# VDE-016: ssi_boolean.cpp SSICurveData 名称解析失败 +# VDE-016: ssi_boolean.cpp 名称解析 — using 声明位置错误 ## 问题描述 -v1.0.3 尝试将 `SSICurveData` 移出匿名 namespace、添加 `#include ` 和 `using vde::brep::ClassResult;`,但 **仍无法通过 GCC 编译**。 +v1.0.4 在匿名 namespace **内部**(line 57)添加了 `using vde::brep::SSICurveData;`,但这些 using 声明仅在匿名 namespace 内部有效。匿名 namespace 关闭后,后续的公共函数(line 509+)仍然找不到 `SSICurveData` 和 `ClassResult`。 -GCC 错误提示 `did you mean 'vde::brep::ClassResult'?` 说明符号可见但非限定名查找失败 — 可能是文件中多处匿名 namespace 嵌套导致的 scope 混淆。 - -## 当前编译错误 (v1.0.3) +## 编译错误 (v1.0.4) ``` -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 ) -error: 'end' was not declared in this scope -error: 'ClassResult' was not declared (did you mean 'vde::brep::ClassResult'?) - at: classify_points() return type +error: 'SSICurveData' was not declared in this scope + at line 512 (compute_all_ssi return type) +error: 'ClassResult' was not declared in this scope + at line 646 (classify_points return type) +error: 'begin'/'end' was not declared in this scope (级联失败) ``` -## 分析 - -1. **SSICurveData** 的 forward declaration 和定义在 `vde::brep` 命名空间内正确,但 GCC 仍需要全限定名 `vde::brep::SSICurveData` — 可能是文件中多个匿名 namespace 导致对作用域的理解与 MSVC 不同 -2. **begin/end** — `#include ` 已添加,仍报错 — 可能是 SSICurveData 错误导致的级联失败 -3. **ClassResult** — `using vde::brep::ClassResult;` 在 `namespace vde::brep` 内部冗余,无效 — 需直接使用全限定名 - -## 建议修复方式 - -将文件中出错的非限定符号改为全限定名: +## 根因 ```cpp -// Line 509: -vde::brep::SSICurveData // 替代 SSICurveData +// ssi_boolean.cpp 当前结构 +namespace vde::brep { // line 34 + struct SSICurveData; // line 43 + using vde::brep::ClassResult; // line 44 — 自引用,无效 + struct SSICurveData { ... }; // line 47 -// Line 612: -const std::vector& // 替代 SSICurveData + namespace { // line 56 + using vde::brep::SSICurveData; // ← 仅在匿名 ns 内有效! + using vde::brep::ClassResult; // ← 同上 + ... + } // line 92 或 432 关闭 -// Line 643: -vde::brep::ClassResult // 替代 ClassResult + // 以下公共函数在 vde::brep 作用域,using 声明已失效 + std::vector compute_all_ssi(...) { // ← 找不到 + std::vector<...ClassResult> classify_points(...) { // ← 找不到 +} ``` -或在 namespace vde::brep 作用域内、匿名 namespace 之前添加局部 using: +## 正确修复 + +将 using 声明放在 `vde::brep` 作用域(匿名 namespace 之外): + ```cpp -// 在所有匿名 namespace 之前 -using vde::brep::SSICurveData; -using vde::brep::ClassResult; +namespace vde::brep { + struct SSICurveData; + using SSICurveData; // ← 放在这里(vde::brep 级别) + using ClassResult; // ← 替代自引用的 using vde::brep::ClassResult; + struct SSICurveData { ... }; + + namespace { + // 不需要这里的 using 了 + ... + } + + // 公共函数现在可以找到 SSICurveData 和 ClassResult + std::vector compute_all_ssi(...) { ... } +} ``` ## 当前 Workaround