Opened 13 years ago
Closed 12 years ago
#3520 closed Bugs (fixed)
Syntax Error in boost/typeof/typeof.hpp
Reported by: | Owned by: | Peder Holt | |
---|---|---|---|
Milestone: | Boost 1.45.0 | Component: | typeof |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | syntax error typeof.hpp | Cc: |
Description
Line 18 of boost/typeof/typeof.hpp is:
# ifndef(BOOST_TYPEOF_EMULATION)
I don't think the brackets around the macro are correct. This line is within an ifdef for the COMO macro: the header file has similar blocks for other compilers, which do not have the brackets on the similar ifndef lines.
Note that unless you use the COMO compiler your (other) compiler (e.g. g++) might not warn about this syntax error, but code within conditionally included code must still be syntactically correct, even though it is not actually included in the Translation Unit. This issue was found with PRQA QAC++, which does report recoverable issues in non-included code.
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Do the Boost.Typeof tests define both __COMO__ and __GNUG__ ? I have checked a testcase of the issue with the online Comeau test:
#if defined(__COMO__) # ifdef __GNUG__ # ifndef(BOOST_TYPEOF_EMULATION) # define BOOST_TYPEOF_KEYWORD typeof # endif # endif #endif
With no defines this compiles successfully. With command line options -D__COMO__ -D__GNUG__ we get:
"ComeauTest.c", line 3: error: expected an identifier # ifndef(BOOST_TYPEOF_EMULATION) ^ 1 error detected in the compilation of "ComeauTest.c".
Which is what I would expect. If just __COMO__ is defined then compilation is successful. Even if the como compiler does parse this code successfully it is still wrong - other compilers still have to parse the code in the non-included #ifdef sections.
comment:4 by , 12 years ago
Milestone: | Boost 1.41.0 → Boost-1.45.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
This is now be fixed
The Boost.Typeof tests pass with como...