# dcc 对 `void` 函数误报 `-Wreturn-type` ## 问题描述 DTK26.04 的 `dcc` 编译无返回的 `void` 函数会报错: ```text void-return.cpp:1:11: error: void function is missing a return statement [-Werror,-Wreturn-type] void f() {} ^ ``` ## 复现方式 镜像: ```text harbor.sourcefind.cn:5443/dcu/admin/base/pytorch:2.7.1-ubuntu22.04-dtk26.04-py3.11 ``` 在容器内执行: ```sh dcc -std=c++17 -Werror=return-type -c void-return.cpp -o void-return.o ``` ## 预期结果 这段源码应该能够正常编译。`void f() {}` 是合法的 C++ 代码,`-Wreturn-type` 不应该仅仅因为 `void` 函数没有显式写出 `return;` 就给出诊断。 当项目启用 `-Werror=return-type` 时,这个问题也会影响更大的构建;普通的空 `void` 函数会在 `dcc` 下变成硬错误。