Put back `-Wsign-conversion` for gcc in CompilerWarnings.cmake

未关闭 适合新手
#162 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@Crayon2000 已经在做这个了。

开始于 2026年8月28日。

  • #163 来自 @Crayon2000 —— 未关闭

评估

难度
2/5
预计耗时
1 小时以内
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cmake, cpp
领域
build-system

调研方向

从 CompilerWarnings.cmake 开始,检查如何为 gcc 和 C++ 选择警告标志。使用 -Wconversion 和 -Wsign-conversion,通过 gcc 重现所提供的 C++23 示例。完成的标准是:在保留所述 C 和 Clang 行为的同时,启用 -Wsign-conversion 后 gcc 的 C++ 构建再次正常工作。

由索引模型根据 Issue 内容生成。

描述

Issue #76 / PR #149 removed the -Wsign-conversion flag in CompilerWarnings.cmake. This may be OK for Clang and gcc using C, but it is not OK for gcc using C++.

The gcc documentation says:

In C, this option is enabled also by -Wconversion.

So NOT for C++.

See this demo for an example: https://godbolt.org/z/8YMbWr3Wx

Using gcc 15.2, compiling the code with -O3 -std=c++23 -Werror -Wconversion will work, but using -O3 -std=c++23 -Werror -Wconversion -Wsign-conversion will not.

主要语言
CMake
星标
1.8k
派生
205
PR 合并指标
30 天内没有已合并 PR

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cpp-best-practices/cmake_template 的其他 Issue

查看 cpp-best-practices/cmake_template 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。