switch missing default label warning under clang
- Langage dominant
- C++
- Étoiles
- 26
- Forks
- 58
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When compiling under clang 19.1.7 with werror and a number of other flags (we run with most warnings enabled), the line https://github.com/boostorg/function/blob/develop/include/boost/function/function_base.hpp#L147 is flagged with `error: switch missing default label [-Werror,-Wswitch-default]`. Given this is based on the enum at https://github.com/boostorg/function/blob/f6b538dbed2e3047dcbd09eb3f5c7f1ffa90d0a9/include/boost/function/function_base.hpp#L105 and all cases are handled a pr has not been provided at this time. I see two approaches, one is doing a compiler warning suppression and the other is adding the default label with a throw or similar as it should be an unreachable place based on the current code. The suppression seems like the simpler answer but may cause a future update to the enum to be missed here while the throw would prevent that at the cost of potentially changing behavior if something is flagged nothrow. Happy to submit a PR but would need guidance no how it should be approached here.
Env:
Alma 9.6
Boost 1.88.0 via cmake
clang 19.1.7
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Lisez include/boost/function/function_base.hpp autour de l’enum à la ligne 105 et du switch à la ligne 147, puis reproduisez l’avertissement avec clang 19.1.7 et les flags d’avertissement indiqués. Consultez les directives du projet avant de choisir entre une suppression et un cas default, et considérez l’issue comme terminée lorsque l’erreur -Wswitch-default signalée ne se produit plus, sans modification involontaire du comportement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp
- Domaine
- compilers
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100