google / google/styleguide

C++ guide: 'else if constexpr' fails with readability/braces

Open
#541 0 comments 0 reactions 0 assignees View on GitHub
lang:cpp
Dominant language
HTML
Stars
39.6k
Forks
12.9k
Avg merge
42m
Merged PRs (30d)
15

Description

"If/else bodies with multiple statements require braces [readability/braces] " error is given for code like

if constexpr (foo) {
...
} else if constexpr (bar) {
...
} else {
...
}
while

if (foo) {
...
} else if (bar) {
...
} else {
...
}
is fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.