boostorg / boostorg/preprocessor
Result of `BOOST_PP_ARRAY_ELEM` can't be included in vs2017 using `/experimental:preprocessor` option
- Dominant language
- C++
- Stars
- 118
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Description
The following code does not compile under VS2017 using `/experimental:preprocessor` option:
```cpp
#include
#include
#define FOO (1,())
#define BAR BOOST_PP_ARRAY_ELEM(0, FOO)
#define HOGE_1(x) x
#define HOGE_2(x) HOGE_1(x)
#define HOGE() HOGE_2(BAR)
#define PUYO_1(x) #x
#define PUYO_2(x) PUYO_1(x)
#define PUYO() PUYO_2(BAR)
#include BAR //C2006
#include HOGE() //C2006
int main(){
std::cout << PUYO() << std::endl;
return 0;
}
```
Both `#include BAR` and `#include HOGE()` directives result in C2006 error, yet, `PUYO` macro could successfully get the string literal formed by `BAR`.
Switching to vs2019 eliminates this issue.
This issue breaks the usage of `` in `
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the shown macro example with VS2017 and `/experimental:preprocessor`, then inspect `` and its use from ``. Done means the affected include directives compile under VS2017 while preserving the existing behavior on VS2019.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100