[PATCH] D23265: [clang-tidy] enhance readability-else-after-return

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 10:43:14 PDT 2016

aaron.ballman added inline comments.

Comment at: clang-tidy/readability/ElseAfterReturnCheck.cpp:45
@@ +44,3 @@
+  for (const auto &BindingName :
+       {"return", "continue", "break", "goto", "throw"}) {
+    if (Result.Nodes.getNodeAs<Stmt>(BindingName)) {
omtcyfz wrote:
> alexfh wrote:
> > This won't work in MSVC2013, I think. Just add a `const char *Labels[] = {"return", ...` (add more consts, constexprs or statics, if you like ;)
> Hm, I'm confused. What exactly wouldn't work in MSVC?
This one *will* work in MSVC 2013 (it was a different initializer list that @alexfh was thinking of, perhaps, where the deduced type of the list was a bit more complex). I just tried it out and the above construct compiles fine with MSVC.

That being said, `const auto &` is the wrong type here, it should be `const auto *`.


More information about the cfe-commits mailing list