boostorg / boostorg/xpressive

Compile Error When Testing with MSVC Using /std:c++latest

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
19
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Hi, I work on Microsoft Visual C++ testing, where we regularly build popular open-source projects, including Boost, with development builds of our compiler and libraries with some particular CL options such as `/std:c++latest`.

Feel free to close this issue if there is no plan of supporting `/std:c++latest` in the future. This change in `/std:c++latest` will be released soon in next VS update.
``
While building and testing Boost from source using `/std:c++latest`, I encountered the following error in the `xpressive` test:
```c++
libs\xpressive\test\test_actions.cpp(187): error C2676: binary '[': 'const boost::proto::exprns_::expr' does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
Tag=boost::proto::tagns_::tag::shift_right,
Args=boost::proto::argsns_::list2,0>,boost::xpressive::basic_regex>>> &>
]
```

This error was encountered in:
[test\test_actions.cpp](https://github.com/boostorg/xpressive/blob/develop/test/test_actions.cpp#L187) (Line 187, 194, 203, 210)

In C++23, the definition of a subscript-expression was changed so that it now takes an expression-list so now a top-level ',' is a separator. **The fix is to wrap the expression in parentheses**. For example in `test_actions.cpp`:
```c++
term = factor >> *(
('*' >> factor)
[ right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left * right)
]
| ('/' >> factor)
[ right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left / right)
]
);
expression = term >> *(
('+' >> term)
[ right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left + right)
]
| ('-' >> term)
[ right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left - right)
]
);
```

should be changed to:
```c++
term = factor >> *(
('*' >> factor)
[ (right = top(stack) // added opening parenthesis
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left * right)) // added closing parenthesis
]
| ('/' >> factor)
[ (right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left / right))
]
);
expression = term >> *(
('+' >> term)
[ (right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left + right))
]
| ('-' >> term)
[ (right = top(stack)
, pop(stack)
, left = top(stack)
, pop(stack)
, push(stack, left - right))
]
);
```

Test log:
[boost_xpressive_test_log.txt](https://github.com/user-attachments/files/19701276/boost_xpressive_test_log.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.