Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Intel Composer XE 2011 Update 4 and SP1 Beta failing to compile Boost.Chrono from boost 1.47 Beta 1.

trekker99
Beginner
632 Views
I am facing some issues compiling Boost 1.47 Beta 1 (Grab from here), specifcially Boost.Chrono library. It compiles fine with VS 2010 SP1 compiler.

When I execute

bjam --with-chrono --toolset=intel

I get the following error message

< snip >
chrono.cpp
.\\boost/chrono/duration.hpp(94): error: expected an expression
&& (boost::is_convertible ^

.\\boost/chrono/duration.hpp(124): error: expected an expression
&& (boost::is_convertible ^
< snip >

Both error messages seem to stem from the same problem, so I will only discuss the first error in this thread. Looking at the section of code (L90 - L100) where the code appears, it is hard to see what is wrong with it (and there is probably nothing wrong).

template bool = (
(boost::is_convertible typename common_type::type>::value)
&& (boost::is_convertible typename common_type::type>::value)
)
>
struct duration_divide_imp
{
};

After some discussion with library author and trying out some ideas, we have realised that if we place an additional parenthesis around the first operand of the && operator, the code can compile. We have no idea why this might be the case, and can only conclude that there is some bug in the Intel compiler.

I have a ticket on boost trac to keep track of this: https://svn.boost.org/trac/boost/ticket/5669

Any insights to why this might be happening?

Thanks.
0 Kudos
8 Replies
Dale_S_Intel
Employee
632 Views
Any chance you could post a .i file (add -E to command line and redirect output to .i file, may need to get rid of -o on command line)
Thanks!
Dale
0 Kudos
trekker99
Beginner
632 Views
Hi Dale,

I have attached what I hoped to be the file you need. compile.log shows the actual error (including bjam's debug output) and CompilerOptions.txt show the exact command line I used to get chrono.i.

Thanks!

Edward
0 Kudos
trekker99
Beginner
632 Views
Just to note that the final version of boost 1.47 will not have this problem as the author has implemented the workaround of adding an additional parenthesis. Anyone trying to re-create this issue should use the beta version.
0 Kudos
trekker99
Beginner
632 Views
Hi Dale, any update?
0 Kudos
Judith_W_Intel
Employee
632 Views

Here is a small reproducer:

// compiles with cl but not icl

template
struct is_convertible
{
static const bool value = true;
};

template (is_convertible::value) && true >
struct C {};

It looks like the compiler is getting confused on the && token and thinks we're dealing with an expression not a declaration (this has to do with support we added long ago for Gnu && labels). Anyway, Dale I filed cq #171750 for the problem. We will fix it ASAP. Thanks for reporting it.

Judy

0 Kudos
trekker99
Beginner
632 Views
Hi Judy,

Thanks for taking the time out to create a small reproducer. Hope to see a fix soon.

Regards,

Edward
0 Kudos
Dale_S_Intel
Employee
632 Views
This should be fixed now. Let us know if you have any further problems.
Dale
0 Kudos
trekker99
Beginner
632 Views
Thanks, it works properly now.
0 Kudos
Reply