doctaweeks / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

std::vector<T*>::const_iterator* parameter: T* not recognized as forward-declarable #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
/path/to/include-what-you-use creditcard_field.cc

What is the expected output? What do you see instead?

No errors.  Instead:

creditcard_field.h should add these lines:
#include "autofill_field.h"             // for AutofillField

creditcard_field.h should remove these lines:
- class AutofillField;  // lines 3-3

The full include-list for creditcard_field.h:
#include <vector>                       // for vector, etc
#include "autofill_field.h"             // for AutofillField

AutofillField is used in the header as:

static void Parse(std::vector<AutofillField*>::const_iterator* iter);

If you take off the ::const_iterator part in the declaration and dfn, iwyu does 
not produce the error stated above.

What version of the product are you using? On what operating system?

r96.

Original issue reported on code.google.com by jhawk...@chromium.org on 29 Mar 2011 at 9:06

Attachments:

GoogleCodeExporter commented 9 years ago
I wonder if this is the same as issue 25.  Both of them are issues with 
standard STL containers that hold pointers.  But I think this may be different, 
though, and have to do with rules about when nested-name-specifiers (the stuff 
before the ::) are allowed to be forward-declared, which is never.  However, 
sub-parts of them can be, as in the example above.

Original comment by csilv...@gmail.com on 29 Mar 2011 at 9:15

GoogleCodeExporter commented 9 years ago
btw, the most useful way to report bugs of this form is with a patch to add a 
test file to tests/ that currently fails under iwyu.  I guess we need to add 
XFAIL support to run_iwyu_tests to support this better.  Then it's less work 
for whoever fixes this up.

Ideally, the tests files would be minimal in that they wouldn't use STL headers 
(which are a pain to debug in clang).  Instead, you could write your own 
templated class that (hopefully) exhibits the same problem.

Original comment by csilv...@gmail.com on 29 Mar 2011 at 9:17

GoogleCodeExporter commented 9 years ago
Sure, I'll start working on the tests.

Original comment by jhawk...@chromium.org on 29 Mar 2011 at 9:20

GoogleCodeExporter commented 9 years ago
Issue 25 has been merged into this issue.

Original comment by csilv...@gmail.com on 31 Mar 2011 at 5:55

GoogleCodeExporter commented 9 years ago
Never mind, I found a small test to add.

The problem is because of a bug in an optimization we have for dealing with 
well-known types like set.  This optimization ignores the * in some situations. 
 OK, all situations.  I'm working on a fix, but I'm going on vacation tomorrow, 
so it may be a little while.

Original comment by csilv...@gmail.com on 31 Mar 2011 at 5:56

GoogleCodeExporter commented 9 years ago
Should be fixed in r104.

Original comment by csilv...@gmail.com on 6 Apr 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Works great, thanks!

Original comment by jhawk...@chromium.org on 7 Apr 2011 at 7:50