477d13dc80
Root cause: using declarations inside anonymous namespace don't propagate to public functions defined after the anonymous namespace closes. Fix: - using SSICurveData; and using ClassResult; at vde::brep scope - Remove self-referencing using vde::brep::ClassResult - Remove duplicate using from inside anonymous namespace
73 lines
2.2 KiB
Markdown
73 lines
2.2 KiB
Markdown
---
|
||
id: VDE-016
|
||
status: fixed
|
||
severity: critical
|
||
category: bug
|
||
date: 2026-07-27
|
||
updated: 2026-07-27
|
||
reporter: ViewDesign
|
||
related: VDE-001, VDE-005, VDE-010
|
||
---
|
||
|
||
# VDE-016: ssi_boolean.cpp 名称解析 — using 声明位置错误
|
||
|
||
## 问题描述
|
||
|
||
v1.0.4 在匿名 namespace **内部**(line 57)添加了 `using vde::brep::SSICurveData;`,但这些 using 声明仅在匿名 namespace 内部有效。匿名 namespace 关闭后,后续的公共函数(line 509+)仍然找不到 `SSICurveData` 和 `ClassResult`。
|
||
|
||
## 编译错误 (v1.0.4)
|
||
|
||
```
|
||
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 (级联失败)
|
||
```
|
||
|
||
## 根因
|
||
|
||
```cpp
|
||
// ssi_boolean.cpp 当前结构
|
||
namespace vde::brep { // line 34
|
||
struct SSICurveData; // line 43
|
||
using vde::brep::ClassResult; // line 44 — 自引用,无效
|
||
struct SSICurveData { ... }; // line 47
|
||
|
||
namespace { // line 56
|
||
using vde::brep::SSICurveData; // ← 仅在匿名 ns 内有效!
|
||
using vde::brep::ClassResult; // ← 同上
|
||
...
|
||
} // line 92 或 432 关闭
|
||
|
||
// 以下公共函数在 vde::brep 作用域,using 声明已失效
|
||
std::vector<SSICurveData> compute_all_ssi(...) { // ← 找不到
|
||
std::vector<...ClassResult> classify_points(...) { // ← 找不到
|
||
}
|
||
```
|
||
|
||
## 正确修复
|
||
|
||
将 using 声明放在 `vde::brep` 作用域(匿名 namespace 之外):
|
||
|
||
```cpp
|
||
namespace vde::brep {
|
||
struct SSICurveData;
|
||
using SSICurveData; // ← 放在这里(vde::brep 级别)
|
||
using ClassResult; // ← 替代自引用的 using vde::brep::ClassResult;
|
||
struct SSICurveData { ... };
|
||
|
||
namespace {
|
||
// 不需要这里的 using 了
|
||
...
|
||
}
|
||
|
||
// 公共函数现在可以找到 SSICurveData 和 ClassResult
|
||
std::vector<SSICurveData> compute_all_ssi(...) { ... }
|
||
}
|
||
```
|
||
|
||
## 当前 Workaround
|
||
|
||
ViewDesign 排除 vde_brep 及其依赖。
|