This fixes PR35381 and an additional bug where clang didn't warn about the C++17 extension when having an expression in the init statement.
Thanks Nicolas Lesser for contributing the patch.
Differential D40445
[C++17] Allow an empty expression in an if init statement Rakete1111 on Nov 24 2017, 9:40 AM. Authored by
Details This fixes PR35381 and an additional bug where clang didn't warn about the C++17 extension when having an expression in the init statement. Thanks Nicolas Lesser for contributing the patch.
Diff Detail Event TimelineComment Actions Hi, thanks for working on this!
Comment Actions Addressed final review comments by adding the appropriate warnings that were missing previously. Comment Actions Added more test coverage for compatibility warnings, and fixed a bug at the same time :).
|
We should only be doing this if InitStmt != nullptr, right? I think this would lead us to be too permissive with while statements, which don't have this feature. Also, it would be nice to emit a c++14-compat warning here, like below.