- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my project, I make heavy use of the boost libraries, especially boost/dynamic_bitset. All worked fine with icc 9.0 (and several gcc version including 4.0), but when I switched to icc 9.1, I get error messages in the boost library code:
icpc bitset.cc
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1435): error: name followed by "::" must be a class or namespace name
const ios_base::iostate ok = ios_base::goodbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1435): error: name followed by "::" must be a class or namespace name
const ios_base::iostate ok = ios_base::goodbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1436): error: name followed by "::" must be a class or namespace name
ios_base::iostate err = ok;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1436): error: expected a ";"
ios_base::iostate err = ok;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: a class or namespace qualified name is required
typename basic_ostream::sentry cerberos(os);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream::sentry cerberos(os);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream::sentry cerberos(os);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream::sentry cerberos(os);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: the global scope has no "sentry"
typename basic_ostream::sentry cerberos(os);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: expected a ";"
typename basic_ostream::sentry cerberos(os);
&n bsp; ^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1439): error: identifier "cerberos" is undefined
if (cerberos) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1455): error: name followed by "::" must be a class or namespace name
const ios_base::fmtflags adjustfield = os.flags() & ios_base::adjustfield;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1455): error: name followed by "::" must be a class or namespace name
const ios_base::fmtflags adjustfield = os.flags() & ios_base::adjustfield;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1458): error: name followed by "::" must be a class or namespace name
if (adjustfield != ios_base::left) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1460): error: expression must have pointer-to-class type
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1461): error: identifier "err" is undefined
err |= ios_base::failbit; // G.P.S.
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1461): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit; // G.P.S.
& nbsp; ^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1466): error: identifier "err" is undefined
if (err == ok) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1469): error: name followed by "::" must be a class or namespace name
typename buffer_type::int_type
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1470): error: expression must have pointer-to-class type
ret = buf->sputc(b.test(i-1)? one : zero);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1472): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1481): error: expression must have pointer-to-class type
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1482): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1493): error: name followed by "::" must be a class or namespace name
try { os.setstate(ios_base::failbit); } catch (...) { rethrow = true; }
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1500): error: identifier "err" is undefined
if(err != ok)
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1448): error: basic_streambuf is not a template
typedef basic_streambuf buffer_type; // G.P.S.
^
detected during instantiation of "std::basic_ostream<_CharT, _Traits> &boost::operator<<(std::basic_ostream<_CharT, _Traits> &, const boost::dynamic_bitset &) [with CharT=char, Traits=std::char_traits, Block=unsigned long, Allocator=std::allocator]"
compilation aborted for bitset.cc (code 2)
The code to reproduce the problem is:
#include
#include
using namespace boost;
using namespace std;
int main()
{
dynamic_bitset<> bits(0);
cout << bits << endl;
return 0;
}
I use boost 1.33.1, which is the current stable version. The code responsible for the problems is as follows:
template
std::basic_ostream&
operator<<(std::basic_ostream& os,
const dynamic_bitset& b)
{
using namespace std;
const ios_base::iostate ok = ios_base::goodbit;
ios_base::iostate err = ok;
typename basic_ostream::sentry cerberos(os);
if (cerberos) {
BOOST_DYNAMIC_BITSET_CTYPE_FACET(Ch, fac, os.getloc());
const Ch zero = BOOST_DYNAMIC_BITSET_WIDEN_CHAR(fac, '0');
const Ch one = BOOST_DYNAMIC_BITSET_WIDEN_CHAR(fac, '1');
try {
typedef typename dynamic_bitset::size_type bitsetsize_type;
typedef basic_streambuf buffer_type; // G.P.S.
buffer_type * buf = os.rdbuf();
size_t npad = os.width() <= 0 // careful: os.width() is signed (and can be < 0)
|| (bitsetsize_type) os.width() <= b.size()? 0 : os.width() - b.size(); //- G.P.S.
const Ch fill_char = os.fill();
const ios_base::fmtflags adjustfield = os.flags() & ios_base:: adjustfield;
// if needed fill at left; pad is decresed along the way
if (adjustfield != ios_base::left) {
for (; 0 < npad; --npad)
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
err |= ios_base::failbit; // G.P.S.
break;
}
}
if (err == ok) {
// output the bitset
for (bitsetsize_type i = b.size(); 0 < i; --i) {// G.P.S.
typename buffer_type::int_type
ret = buf->sputc(b.test(i-1)? one : zero);
if (Tr::eq_int_type(Tr::eof(), ret)) {
err |= ios_base::failbit;
break;
}
}
}
if (err == ok) {
// if needed fill at right
for (; 0 < npad; --npad) {
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
err |= ios_base::failbit;
break;
&nbs p; }
}
}
os.width(0);
} catch (...) { // see std 27.6.1.1/4
bool rethrow = false;
try { os.setstate(ios_base::failbit); } catch (...) { rethrow = true; }
if (rethrow)
throw;
}
}
if(err != ok)
os.setstate(err); // may throw exception
return os;
}
The problems can be easily solved by adding
using std::ios_base;
using std::basic_ostream;
using std::basic_streambuf;
at the top of the operator<< function, but I think this should not be necessary since it states using namespace std, so I think it could be problem with name lookup in the new compiler.
If needed, I can send the complete source code or the precompiled code.
icpc bitset.cc
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1435): error: name followed by "::" must be a class or namespace name
const ios_base::iostate ok = ios_base::goodbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1435): error: name followed by "::" must be a class or namespace name
const ios_base::iostate ok = ios_base::goodbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1436): error: name followed by "::" must be a class or namespace name
ios_base::iostate err = ok;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1436): error: expected a ";"
ios_base::iostate err = ok;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: a class or namespace qualified name is required
typename basic_ostream
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: type name is not allowed
typename basic_ostream
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: the global scope has no "sentry"
typename basic_ostream
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1438): error: expected a ";"
typename basic_ostream
&n bsp; ^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1439): error: identifier "cerberos" is undefined
if (cerberos) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1455): error: name followed by "::" must be a class or namespace name
const ios_base::fmtflags adjustfield = os.flags() & ios_base::adjustfield;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1455): error: name followed by "::" must be a class or namespace name
const ios_base::fmtflags adjustfield = os.flags() & ios_base::adjustfield;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1458): error: name followed by "::" must be a class or namespace name
if (adjustfield != ios_base::left) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1460): error: expression must have pointer-to-class type
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1461): error: identifier "err" is undefined
err |= ios_base::failbit; // G.P.S.
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1461): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit; // G.P.S.
& nbsp; ^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1466): error: identifier "err" is undefined
if (err == ok) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1469): error: name followed by "::" must be a class or namespace name
typename buffer_type::int_type
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1470): error: expression must have pointer-to-class type
ret = buf->sputc(b.test(i-1)? one : zero);
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1472): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1481): error: expression must have pointer-to-class type
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1482): error: name followed by "::" must be a class or namespace name
err |= ios_base::failbit;
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1493): error: name followed by "::" must be a class or namespace name
try { os.setstate(ios_base::failbit); } catch (...) { rethrow = true; }
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1500): error: identifier "err" is undefined
if(err != ok)
^
/usr/include/boost/dynamic_bitset/dynamic_bitset.hpp(1448): error: basic_streambuf is not a template
typedef basic_streambuf
^
detected during instantiation of "std::basic_ostream<_CharT, _Traits> &boost::operator<<(std::basic_ostream<_CharT, _Traits> &, const boost::dynamic_bitset
compilation aborted for bitset.cc (code 2)
The code to reproduce the problem is:
#include
#include
using namespace boost;
using namespace std;
int main()
{
dynamic_bitset<> bits(0);
cout << bits << endl;
return 0;
}
I use boost 1.33.1, which is the current stable version. The code responsible for the problems is as follows:
template
std::basic_ostream
operator<<(std::basic_ostream
const dynamic_bitset
{
using namespace std;
const ios_base::iostate ok = ios_base::goodbit;
ios_base::iostate err = ok;
typename basic_ostream
if (cerberos) {
BOOST_DYNAMIC_BITSET_CTYPE_FACET(Ch, fac, os.getloc());
const Ch zero = BOOST_DYNAMIC_BITSET_WIDEN_CHAR(fac, '0');
const Ch one = BOOST_DYNAMIC_BITSET_WIDEN_CHAR(fac, '1');
try {
typedef typename dynamic_bitset
typedef basic_streambuf
buffer_type * buf = os.rdbuf();
size_t npad = os.width() <= 0 // careful: os.width() is signed (and can be < 0)
|| (bitsetsize_type) os.width() <= b.size()? 0 : os.width() - b.size(); //- G.P.S.
const Ch fill_char = os.fill();
const ios_base::fmtflags adjustfield = os.flags() & ios_base:: adjustfield;
// if needed fill at left; pad is decresed along the way
if (adjustfield != ios_base::left) {
for (; 0 < npad; --npad)
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
err |= ios_base::failbit; // G.P.S.
break;
}
}
if (err == ok) {
// output the bitset
for (bitsetsize_type i = b.size(); 0 < i; --i) {// G.P.S.
typename buffer_type::int_type
ret = buf->sputc(b.test(i-1)? one : zero);
if (Tr::eq_int_type(Tr::eof(), ret)) {
err |= ios_base::failbit;
break;
}
}
}
if (err == ok) {
// if needed fill at right
for (; 0 < npad; --npad) {
if (Tr::eq_int_type(Tr::eof(), buf->sputc(fill_char))) {
err |= ios_base::failbit;
break;
&nbs p; }
}
}
os.width(0);
} catch (...) { // see std 27.6.1.1/4
bool rethrow = false;
try { os.setstate(ios_base::failbit); } catch (...) { rethrow = true; }
if (rethrow)
throw;
}
}
if(err != ok)
os.setstate(err); // may throw exception
return os;
}
The problems can be easily solved by adding
using std::ios_base;
using std::basic_ostream;
using std::basic_streambuf;
at the top of the operator<< function, but I think this should not be necessary since it states using namespace std, so I think it could be problem with name lookup in the new compiler.
If needed, I can send the complete source code or the precompiled code.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I will look into the probelm asap. Is it possible or did you already prepared a reproducer ? If it's too complicated you can send me the precompiled code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
my apologies for the delay, but I have been off for vacation. I've just created an issue (no. 388524) in the support area with three files attached. The first file is the boost source code file, the second a simple demo program, and the last one contains the preprocessed output from the demo program. I have marked the problem site (operator<< in file dynamic_bitset.hpp) with a comment "// These using directives fixe problems with Intel C++ 9.1". The following three using directives solve the problem.
my apologies for the delay, but I have been off for vacation. I've just created an issue (no. 388524) in the support area with three files attached. The first file is the boost source code file, the second a simple demo program, and the last one contains the preprocessed output from the demo program. I have marked the problem site (operator<< in file dynamic_bitset.hpp) with a comment "// These using directives fixe problems with Intel C++ 9.1". The following three using directives solve the problem.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page