5de74b543a
VDE-001 through VDE-013 all resolved in v1.0.1 ViewDesign workarounds can now be removed
31 lines
945 B
Markdown
31 lines
945 B
Markdown
---
|
||
id: VDE-003
|
||
status: fixed
|
||
severity: medium
|
||
category: compat
|
||
date: 2026-07-27
|
||
reporter: ViewDesign
|
||
---
|
||
|
||
# VDE-003: std::fpos 运算符歧义(GCC C++20)
|
||
|
||
## 问题描述
|
||
|
||
在 GCC + C++20 模式下,std::fpos 与整型之间的加减运算产生歧义。libstdc++ 的 <bits/ios_base.h> 定义了 operator-(streamoff, fpos) 和 operator+(streamoff, fpos),但没有 operator-(fpos, streamoff)。而在 C++20 中新增了 reversed operator candidates,导致 fpos - int 产生多个候选重载。
|
||
|
||
## 影响文件
|
||
|
||
- src/foundation/io_3mf.cpp
|
||
|
||
## ViewDesign 侧 Workaround
|
||
|
||
通过 cmake/vde_gcc_compat.h 注入额外的运算符重载(注入 std 命名空间是 UB,仅作为临时方案)。
|
||
|
||
## 建议修复方向
|
||
|
||
1. 在 io_3mf.cpp 中避免 fpos - int 模式,先转换为 streamoff
|
||
2. 使用 static_cast<streamoff>(fpos) 消除歧义
|
||
|
||
---
|
||
*此文件由 ViewDesign 工程自动生成。处理完成后请更新 status 字段。*
|