Return of bug#6554 (Compiler error dereferencing multi_array value via an iterator)

Open
#31 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
data

Research direction

Start by reproducing the failing expression from the issue with boost/multi_array.hpp in the linked Godbolt example, then compare it with the dereference form that compiles. Inspect the multi_array iterator path involved in a.begin()->begin()->value. Done means the failing expression compiles and assigns the value as shown, with regression coverage for this example.

Written by the indexing model from the issue text.

Description

The bug described in https://svn.boost.org/trac10/ticket/6554 seems to return. I tried the example from this bug in godbolt: https://godbolt.org/z/4vMf8oo4q and it fails to compile. The code I used is:

#include <boost/multi_array.hpp>

struct data
{
	int	value;
};
typedef boost::multi_array<data, 2> array_type;

int main() {
    array_type	a(boost::extents[4][5]);

    // ERROR: Cannot compile this line
    a.begin()->begin()->value = 7;

    // Compiles successfully
    (*a.begin()->begin()).value = 5;
    return 0;
}

All versions of boost on godbolt (1.64 to 1.79) seem to be affected.

Dominant language
C++
Stars
32
Forks
39
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/multi_array

All issues in boostorg/multi_array

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.