Error when compiling tensor with NDEBUG
- Dominant language
- C++
- Stars
- 122
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
I'm compiling a simple program which includes the `tensor.hpp` header:
```c++
#include
#include
int main()
{
auto A = boost::numeric::ublas::tensor{3,4,2};
std::cout << "A=" << A << std::endl;
return 0;
}
```
This works fine if I don't define `NDEBUG`. However, in release mode with (`-DNDEBUG` argument to the compiler), this fails:
```
In file included from /celibs/boost_1_72_0/boost/numeric/ublas/tensor.hpp:22,
from :1:
/celibs/boost_1_72_0/boost/numeric/ublas/tensor/strides.hpp:215:9: error: expected unqualified-id before '<' token
215 | template
| ^
/celibs/boost_1_72_0/boost/numeric/ublas/tensor/strides.hpp:223:2: error: expected ';' before 'inline'
223 | }
| ^
| ;
In file included from /celibs/boost_1_72_0/boost/numeric/ublas/tensor.hpp:24,
from :1:
/celibs/boost_1_72_0/boost/numeric/ublas/tensor/tensor.hpp:333:2: error: expected unqualified-id before 'template'
333 | template
| ^~~~~~~~
/celibs/boost_1_72_0/boost/numeric/ublas/tensor/tensor.hpp:355:2: error: expected unqualified-id before 'template'
355 | template
| ^~~~~~~~
...
```
As you can see in [compiler explorer](https://godbolt.org/z/RFCnQs), this happens both on gcc 9.3 and clang 10.0.0 with these command-line options: `-DNDEBUG -std=c++17`
I also found that adding `#define BOOST_UBLAS_INLINE` before including `tensor.hpp` solves the compilation problem (but, of course, cancels inlining which probably hurts performance).
Am I using the wrong compilation options? ublas' [documentation](https://github.com/boostorg/ublas/blob/develop/doc/index.html#L402) says I should define `NDEBUG` preprocessor symbol to get proper performance (release mode). I assume tensor was tested with `-DNDEBUG` and `-O3` etc. BTW I think that the error reported in #79 might also be related to `-DNDEBUG`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.