This bugzilla service is closed. All entries have been migrated to

Bug 1009

Summary: One-index coeff accessors should static_assert on LinearAccessBit
Product: Eigen Reporter: Benoit Jacob <jacob.benoit.1>
Component: Core - expression templatesAssignee: Nobody <eigen.nobody>
Severity: Unknown CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 558    
Description Flags
minimal testcase
Add static assertions on linear access. Breaks lots of tests at the moment. none

Description Benoit Jacob 2015-05-01 15:10:30 UTC
Created attachment 570 [details]
minimal testcase

coeff(Index) and coeffRef(Index), and corresponding operator()(Index) and operator[], should probably require LinearAccessBit, right?

The attached testcase is how I came across this: I was mistakenly using operator()(Index) on a Block<MatrixXf>, so I was addressing coefficients outside of the block.

Also attaching a patch that does this static-assertion; but I can't push it at the moment, because it seems to be breaking lots of tests, and I don't currently have time to look into them...
Comment 1 Benoit Jacob 2015-05-01 15:11:51 UTC
Created attachment 571 [details]
Add static assertions on linear access. Breaks lots of tests at the moment.
Comment 2 Gael Guennebaud 2015-11-12 16:30:30 UTC
This flags is now handled by the evaluator, so the test should be internal::evaluator<Derived>::Flags&LinearAccessBit, but that does not seem to be sufficient. If I relax it to:

bool(internal::evaluator<Derived>::Flags & LinearAccessBit) || Derived::IsVectorAtCompileTime

then everything compile again meaning that some vector expressions does not have the LinearAccessBit flag...
Comment 3 Gael Guennebaud 2015-11-27 09:08:13 UTC
Summary:     Bug 1009, part 1/2: make sure vector expressions expose LinearAccessBit flag.
Summary:     Bug 1009, part 2/2: add static assertion on LinearAccessBit in coeff(index)-like methods.
Comment 4 Nobody 2019-12-04 14:35:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: