boostorg / boostorg/array

Non standard return fails to compile

Open
#29 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
24
Forks
55
PR merge metrics
No merged PRs in 30d

Description

This statement:
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];

is a non-standard form of return.

In case we compile optimized code that lacks assert function but still want something this code fails to compile.

Separating this to a more standard form solves the issue:

BOOST_ASSERT_MSG( i < N, "out of range" );
return elems[i];

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the Boost.Array source for the exact return statement containing BOOST_ASSERT_MSG and elems[i], then inspect its surrounding function. Separate the assertion from the return as described and build the optimized configuration to confirm it compiles; run the relevant Boost.Array tests to verify behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.