5

I have the following code in Eclipse CDT (Juno SR1):

#include <fstream>
#include <iostream>

#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>

int main() 
{
   using namespace std;
   namespace io = boost::iostreams;

   ifstream file("data.gz", ios_base::in | ios_base::binary);
   io::filtering_streambuf<io::input> in;
   in.push(io::gzip_decompressor());       // error here
   in.push(file);                          // and here
}

g++ 4.7.2 has no problem with the code. Eclipse, however, complains about the two in.push() lines. The error message is the same in both cases:

Invalid arguments '
Candidates are:
void push(std::basic_streambuf<#10000,#10001> &, ?, ?)
void push(std::basic_istream<#10000,#10001> &, ?, ?)
void push(std::basic_ostream<#10000,#10001> &, ?, ?)
void push(std::basic_iostream<#10000,#10001> &, ?, ?)
void push(const boost::iterator_range<#10000> &, ?, ?)
void push(const boost::iostreams::pipeline<#10000,#10001> &)
void push(const #10000 &, ?, ?, boost::disable_if<boost::iostreams::is_std_io<#10000>,void>::type *)
'

How do I fix or work around this to stop CDT complaining?

NPE
  • 486,780
  • 108
  • 951
  • 1,012
  • hm strange: I know CDT had quite some issues with several boost features... but all of them are fixed by now. Could you try disabling the "code analysis" feature and or rebuild your projects indexes? – Najzero Jan 20 '13 at 09:34
  • 1
    Rebuilding project indices makes no difference. Disabling code analysis stops CDT from complaining; however, I'd prefer to keep code analysis on if at all possible. – NPE Jan 20 '13 at 11:38
  • 1
    What I would expect is that the std::ifstream is implicitly converted to its baseclass std::istream, so that the second candidate matches. What I would try is passing `static_cast(file)` to the push() function. If this doesn't work, the only thing I could imagine is a mismatch in the template parameters, but that would be a really strange error. On the other hand, I haven't worked with CDT yet, so it's hard to tell. – Ulrich Eckhardt Jan 26 '13 at 00:55

1 Answers1

0

I don't see this problem in Juno SR2, so probably the simplest solution would be to update your Eclipse installation, assuming that all the plugins you use are compatible with the latest SR.

Nicola Musatti
  • 17,834
  • 2
  • 46
  • 55