[PATCH] D33722: [clang-tidy] Add checker for undelegated copy of base classes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 05:26:50 PDT 2017


aaron.ballman added inline comments.


================
Comment at: clang-tidy/misc/UndelegatedCopyOfBaseClassesCheck.cpp:92
+  // Loop until the beginning of the initialization list.
+  while (!Tok.is(tok::r_paren))
+    Lex.LexFromRawLexer(Tok);
----------------
szdominik wrote:
> aaron.ballman wrote:
> > This doesn't balance tokens. What about:
> > ```
> > struct S {
> >  /* ... */
> > };
> > 
> > struct T : S {
> >   T(const T &O) : S((1 + 2), O) {}
> > };
> > ```
> The loop search only the first right paren in the line, which is the end of parameter list ( "...&0**)**" ), so, as I see, it doesn't interesting what happens after the colon.
Let me try again. :-)
```
struct S {
 /* ... */
};

struct T : S {
  T(const T &O, int = (1 + 2)) : S((1 + 2), O) {}
};
```


https://reviews.llvm.org/D33722





More information about the cfe-commits mailing list