Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
hg-misc-tools
Commits
486bdeff
Commit
486bdeff
authored
May 25, 2026
by
one
Browse files
Add dcc-void-return
parent
24e48648
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
projects/dcc-void-return/README.md
projects/dcc-void-return/README.md
+31
-0
projects/dcc-void-return/void-return.cpp
projects/dcc-void-return/void-return.cpp
+7
-0
No files found.
projects/dcc-void-return/README.md
0 → 100644
View file @
486bdeff
# dcc 对 `void` 函数误报 `-Wreturn-type`
## 复现方式
镜像:
```
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
```
## 实际结果
DTK 26.04 的
`dcc`
会报错:
```
text
void-return.cpp:1:11: error: void function is missing a return statement [-Werror,-Wreturn-type]
void f() {}
^
```
## 预期结果
这段源码应该能够正常编译。
`void f() {}`
是合法的 C++ 代码,
`-Wreturn-type`
不应该仅仅因为
`void`
函数没有显式写出
`return;`
就给出诊断。
当项目启用
`-Werror=return-type`
时,这个问题也会影响更大的构建;普通的空
`void`
函数会在
`dcc`
下变成硬错误。
projects/dcc-void-return/void-return.cpp
0 → 100644
View file @
486bdeff
void
f
()
{}
int
main
()
{
f
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment